0

I use the following code:

fpr, tpr, t = roc_curve(true_categories, predicted_categories)

I know the predicted_categories should be probability or confidence.

But as predict_proba() seems not working for keras Functional API, how should I get the predicted_categories right?

I tried

predicted_categories = tf.argmax(y_pred, axis=1)

and the ROC looks like this:

ROC with a sharp angle

and this

predicted_categories =  = tf.reduce_max(y_pred, axis=1, keepdims=True)

the ROC looks like this:

an ROC with AUC ~50%, which should be 85%

Both of them are not what I expected...

Any suggestion is appreciated!

  • Did you try just providing the model output as scores, without any processing, because predict_proba is not necessary here, your model likely outputs probabilities already. – Dr. Snoopy Jul 24 '21 at 17:10
  • I did think of this method. However, the original output "y_pred" has a shape of (114, 2), which does not fit the roc_curve() function. It return error: "multilabel-indicator format is not supported"... – Anesthesiologist Jul 26 '21 at 01:08

0 Answers0