I am doing a binary classification. I have unbalanced data, and I used the svm weight, trying to mitigate the situation ... As you can see, I calculated and plotted a curve for each class, and I have the following plot:
It seems that two classes are a little to one .. . and I'm not sure if I am doing the right thing or not, because for the first time for me to draw my own curve curve ... I use Scikit learns to draw ... is it right to build each class separately .. and the classifier cannot classify blue class?
this is the code i used to get the graph:
y_pred = clf.predict_proba(X_test)[:,0]
y_pred2 = clf.predict_proba(X_test)[:,1]
fpr, tpr, thresholds = metrics.roc_curve(y_test, y_pred)
auc=metrics.auc(fpr, tpr)
print "auc for the first class",auc
fpr2, tpr2, thresholds2 = metrics.roc_curve(y_test, y_pred2)
auc2=metrics.auc(fpr2, tpr2)
print "auc for the second class",auc2
plt.plot(fpr,tpr)
plt.plot(fpr2,tpr2)
plt.xlim([0.0,1.0])
plt.ylim([0.0,1.0])
plt.title('Roc curve')
plt.xlabel('False positive rate')
plt.ylabel('True positive rate')
plt.legend(loc="lower right")
plt.show()
I know there is a better way to write as a dictionary, for example, but I was just trying to see the curve first