Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def plotROC(X_train_res, y_train_res, X_test, y_test):
- cl = MultinomialNB()
- cl.fit(X_train_res, y_train_res)
- res = cl.predict_proba(X_test)
- x = np.transpose(res)[0]
- rc = roc_curve(y_test, x)
- print(y_test[:5])
- print(x[:5])
- aucl = auc(rc[0], rc[1])
- lw=2
- plt.plot(rc[0],rc[1], color='darkorange',
- lw=lw, label='ROC curve (area = %0.2f)' % aucl)
- #plt.plot(rc2[0],rc2[1], color='deeppink',
- # lw=lw, label='ROC curve (area = %0.2f)' % aucl)
- plt.plot([0, 1], [0, 1], color='navy', lw=lw, linestyle='--')
- plt.xlim([0.0, 1.0])
- plt.ylim([0.0, 1.05])
- plt.xlabel('False Positive Rate')
- plt.ylabel('True Positive Rate')
- plt.title('Receiver operating characteristic example')
- plt.legend(loc="lower right")
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement