def plot_roc(self):
for learner, clf in self._clf.iteritems():
# Make the predictions
(X_test, y_test) = self._test_data
y_pred = clf.predict(X_test)
# Get (f)alse (p)ositive (r)ate, (t)rue (p)ositive (r)ate
fpr, tpr, _ = roc_curve(y_test, y_pred)
# Add this classifier's results to the plot
plt.plot(fpr, tpr, label='%s (area = %0.2f)'\
% (learner, auc(fpr, tpr)))
# Now do the plot
# NOTE: plot code stolen from scikit-learn docs (http://bit.ly/236k6M3)
plt.xlim([-0.05, 1.05])
plt.ylim([-0.05, 1.05])
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('Receiver Operating Characteristic (ROC)')
plt.legend(loc="lower right")
plt.show()
MLNPCapstone.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录