Following up from here: Converting a 1D array into a 2D class-based matrix in python
I want to draw ROC curves for each of my 46 classes. I have 300 test samples for
roc_curve
takes parameter with shape [n_samples]
(link), and your inputs (either y_test_bi
or y_pred_bi
) are of shape (300, 46)
. Note the first
I think the problem is y_pred_bi
is an array of probabilities, created by calling clf.predict_proba(X)
(please confirm this). Since your classifier was trained on all 46 classes, it outputs a 46-dimensional vectors for each data point, and there is nothing label_binarize
can do about that.
I know of two ways around this:
label_binarize
before clf.fit()
and then compute ROC curveroc_curve
. This is my preferred approach by I am assuming y_pred_bi
contains probabilities