OneClassSVM _train_test all data

Viewed 25

I try to detect anomaly data from dataframe (dataset).

I used OneClassSVM and split train and test data (20% for test) and detect anomaly data, but at last I want one column with all data for each row with 0 or 1 for output(not just for test data).

Now OneClassSVM predict for test data and:

#Predic The Anomalies 
prediction = One_Class_Svm.predict(X_test)

#change the anomalies value to make consistent with the True value
prediction = [1 if i == -1 else 0 for i in prediction] 

I have main output for prediction and should compare this column with prediction (for all data).

For example: for 12000 samples after predict and detect anomaly I have one column((2400 * 1)shape, for y_test prediction).

And 9600 samples were for train.

At last I want to have one column that have 12000*1 dimension to compare prediction with main output.

0 Answers
Related