#false positive rate,fpr= FP/(TN+FP) OR fpr=1-specificty, tpr=sensitivity
y_pred_knn_p =knn.predict_proba(X_test)[:,1]
models=[y_pred_knn_p]
label=['KNN']
# plotting ROC curves
plt.figure(figsize=(10, 8))
m=np.arange(1)
for m in m:
fpr, tpr,thresholds= metrics.roc_curve(y_test,models[m])
print('model:',label[m])
print('thresholds:',np.round(thresholds,3))
print('tpr: ',np.round(tpr,3))
print('fpr: ',np.round(fpr,3))
plt.plot(fpr,tpr,label=label[m])
plt.xlim([0.0,1.0])
plt.ylim([0.0,1.0])
plt.title('ROC curve for Cancer classifer')
plt.xlabel('False positive rate (1-specificity)')
plt.ylabel('True positive rate (sensitivity)')
plt.legend(loc=4,)
0 Comments
Sign in to comment.