from sklearn.metrics import precision_score, recall_score, f1_score
print("precision score: ", precision_score(y_true, y_predict))
print("recall score: ", recall_score(y_true, y_predict))
print("f1 score: ", f1_score(y_true, y_predict))
from sklearn.model_selection import cross_val_predict
y_scores = cross_val_predict(model_name, x_train, y_train, cv=3,
method="decision_function")
from sklearn.metrics import roc_auc_score
print("roc/auc score: ", roc_auc_score(y_true, y_scores))
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
from sklearn.metrics import roc_curve
fpr, tpr, thresholds = roc_curve(y_true, y_scores)
def plot_roc_curve(fpr, tpr, label=None):
plt.plot(fpr, tpr, linewidth=2, label=label)
plt.plot([0, 1], [0, 1], 'k--')
plt.axis([0, 1, 0, 1])
plt.xlabel('False Positive Rate', fontsize=16)
plt.ylabel('True Positive Rate', fontsize=16)
plt.figure(figsize=(8, 6))
plot_roc_curve(fpr, tpr)
plt.show()