Skip to content

Instantly share code, notes, and snippets.

@JulianaGuama
Last active March 17, 2019 03:07
Show Gist options
  • Save JulianaGuama/1b76a4907193445b01320ad2b8a4dc4e to your computer and use it in GitHub Desktop.
Save JulianaGuama/1b76a4907193445b01320ad2b8a4dc4e to your computer and use it in GitHub Desktop.
ROC Python
#https://scikit-learn.org/stable/modules/generated/sklearn.metrics.roc_curve.html
from sklearn.metrics import roc_curve
y_true = np.array([1, 1, 2, 2])
y_pred = np.array([0.1, 0.4, 0.35, 0.8])
#pos_label é onde indica-se o valor da classe de interesse
fpr, tpr, thresholds = metrics.roc_curve(y, scores, pos_label=2)
print(fpr)
#>>>array([0. , 0. , 0.5, 0.5, 1. ])
print(tpr)
#>>>array([0. , 0.5, 0.5, 1. , 1. ])
print(thresholds)
#>>>array([1.8 , 0.8 , 0.4 , 0.35, 0.1 ])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment