Last active
August 18, 2019 15:46
-
-
Save stillbigjosh/12a6cd6168e51c7b565d6ea0dcaf6f5c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| model = OneClassSVM(kernel='rbf') | |
| model.fit(X_train) | |
| #model.fit(X_test) | |
| y_train = model.predict(X_train) | |
| y_test = model.predict(X_test) | |
| y_ndata = model.predict(X_data) | |
| #number of anomalies | |
| train = y_train[y_train == 1].size | |
| test = y_test[y_train == 1].size | |
| print("Size of inliers in Train set:", train) | |
| print("Size of inliers in Test set:", test) | |
| print("Size of inliers in Real data:", y_ndata[y_ndata == 1].size) | |
| train_anomaly = y_train[y_train == -1].size | |
| test_anomaly = y_train[y_train == -1].size | |
| print("Size of outliers in Train set:", train_anomaly) | |
| print("Size of outliers in Test set:", test_anomaly) | |
| print("Size of outliers in Real data:", y_ndata[y_ndata == -1].size) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment