0

can anyone help me with this error?

y_test['cEXT'].shape ,y_test['cEXT'].ndim # returns ((982,), 1)
Y_test_probs.shape,Y_test_probs.ndim # returns ((982,), 1)

# AOC ROC Curve
import scikitplot as skplt
Y_test_probs = np.squeeze(model_cEXT.predict(X_test))

skplt.metrics.plot_roc_curve(y_test['cEXT'], Y_test_probs,
                       title="Digits ROC Curve", figsize=(12,6));

Error:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-136-33407ee6fd1a> in <module>()
      4 
      5 skplt.metrics.plot_roc_curve(y_test['cEXT'], Y_test_probs,
----> 6                        title="Digits ROC Curve", figsize=(12,6));

1 frames
/usr/local/lib/python3.7/dist-packages/scikitplot/metrics.py in plot_roc_curve(y_true, y_probas, title, curves, ax, figsize, cmap, title_fontsize, text_fontsize)
    255     roc_auc = dict()
    256     for i in range(len(classes)):
--> 257         fpr[i], tpr[i], _ = roc_curve(y_true, probas[:, i],
    258                                       pos_label=classes[i])
    259         roc_auc[i] = auc(fpr[i], tpr[i])

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
Juned Ansari
  • 5,035
  • 7
  • 56
  • 89

1 Answers1

0

It seems the y_probas needs two dimensions (n_samples, n_classes)

maybe you can try to add a dimension by:

np.expand_dims(Y_test_probs, -1)