Reputation: 1
I am using Python 3.6,sklearn.svm.OneClassSVM to practice OSVM and I want to
calculate ROC, AUC.
I have used decision_function() to calculate ROC and AUC ,the code is below.
I want to evaluate the value that I calculate by decision_function.
Can I only use predicted label and real label to obtain ROC, AUC value?
y_score = oneclass.decision_function(testing_data)
roc_auc = metrics.roc_auc_score(Y_test, y_score)
Upvotes: 0
Views: 518
Reputation: 6270
I am not sure if I get your question complete correctly, but if you do this:
clf = svm.OneClassSVM(nu=0.1, kernel="rbf", gamma=0.1)
clf.fit(X_train)
y_pred_train = clf.predict(X_train)
y_score = clf.predict(X_test)
Then you should be able to use:
from sklearn.metrics import roc_auc_score
roc_auc_score(y_test, y_score)
``
Upvotes: 0