(ROC). sklearn matplotlib .
ROC . , , , . Area Under Curve (AUC) - : , .
import pandas as pd
df = pd.read_csv('sample_data.csv', header=None, names=['classifier','category'])
df = df.loc[(df.category==1.0) | (df.category==0.0),:]
df.head()
from matplotlib import pyplot as plt
from sklearn.metrics import roc_curve, auc
figure, ax1 = plt.subplots(figsize=(8,8))
fpr,tpr,_ = roc_curve(df.category,df.classifier)
roc_auc = auc(fpr,tpr)
ax1.plot(fpr,tpr, label='%s (area = %0.2f)' % ('Classifier',roc_auc))
ax1.plot([0, 1], [0, 1], 'k--')
ax1.set_xlim([0.0, 1.0])
ax1.set_ylim([0.0, 1.0])
ax1.set_xlabel('False Positive Rate', fontsize=18)
ax1.set_ylabel('True Positive Rate', fontsize=18)
ax1.set_title("Receiver Operating Characteristic", fontsize=18)
plt.tick_params(axis='both', labelsize=18)
ax1.legend(loc="lower right", fontsize=14)
plt.grid(True)
figure.show()
, :