Inverted ROC/AUC (0.65) when using sklearn SVM

Viewed 145

I fit an rbf SVM to training data and then computed the AUC and plotted an ROC on that data. I expect it to overfit and yet instead the AUC seems to be 0.35. The accuracy is 62%. Inverting the ROC yields results of 0.65 (obviously) but I am unsure if this is a problem with my code, the model or probabilities in sklearn SVMs.

Code:

classifier = svm.SVC(kernel='rbf',
                     probability=True)
classifier.fit(X_train, y_train)


fpr, tpr, thresholds = roc_curve(y_train, classifier.predict_proba(X_train)[:,1], pos_label=1)
logit_roc_auc = np.trapz(tpr,fpr)
plt.figure()
plt.plot(fpr, tpr, label='Logistic Regression (area = %0.2f)' % logit_roc_auc)
plt.plot([0, 1], [0, 1],'r--')
plt.show()

the plot

0 Answers
Related