Why Does Roc_curve Return Only 3 Values?
I pass y_true and y_pred of shapes (999,) with labels 0 and 1 to FP, TP, threshold = roc_curve(y_true, y_pred, pos_label=1) and as a result array of only 3 elements is being return
Solution 1:
ROC curves are built by varying a decision threshold: you should not pass hard class predictions as y_score
, but instead the probability scores or some other confidence measure.
From the documentation:
y_score : array, shape = [n_samples]
Target scores, can either be probability estimates of the positive class, confidence values, or non-thresholded measure of decisions (as returned by "decision_function" on some classifiers).
Passing a hard binary classification, there are only three relevant thresholds: one below 0, one between 0 and 1, and one greater than 1.
Post a Comment for "Why Does Roc_curve Return Only 3 Values?"