def print_roc(self, y_true, y_scores, filename):
'''
Prints the ROC for this model.
'''
fpr, tpr, thresholds = metrics.roc_curve(y_true, y_scores)
plt.figure()
plt.plot(fpr, tpr, color='darkorange', label='ROC curve (area = %0.2f)' % self.roc_auc)
plt.plot([0, 1], [0, 1], color='navy', 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')
plt.legend(loc="lower right")
plt.savefig(filename)
plt.close()
评论列表
文章目录