python - Returning a probability vector for predications -
i'm using scikit-learn classification. there way probability vector says how confident classifier prediction? want vector entire test set, not single element. need compute roc curve , auc.
if goal roc curve , auc, checkout out sklearn.metrics.roc_auc_score
here.
from docs:
>>> import numpy np >>> sklearn.metrics import roc_auc_score >>> y_true = np.array([0, 0, 1, 1]) >>> y_scores = np.array([0.1, 0.4, 0.35, 0.8]) >>> roc_auc_score(y_true, y_scores) 0.75
note roc_auc_score suited binary classification tasks -- if you're dealing multiclass classification you'll have compute separate roc_auc_score
values each class.
Comments
Post a Comment