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 returned. What can be wrong?
The whole code snippet
def get_roc_auc_scores(y_pred_labels, y_true_labels):
roc_auc_scores = {key: {'FP': [], 'TP': [], 'Scores': []} for key in ['Low', 'High']}
for key in roc_auc_scores.keys():
for y_pred in y_pred_labels:
# Get True Positive and False Positive labels
fp, tp, thresh = roc_curve(y_true_labels[key], y_pred, pos_label=1)
roc_auc_scores[key]['FP'].append(fp)
roc_auc_scores[key]['TP'].append(tp)
# Get AUC score
auc_score = roc_auc_score(y_true_labels[key], y_pred)
roc_auc_scores[key]['Scores'].append(auc_score)
return roc_auc_scores
where y_pred_labels
is a list containing 6 arrays
with predictions and y_true_labels
contains true labels. High and Low describe only the specific case.