multilabel-indicator is not supported
is the error message I get, when trying to run:
confusion_matrix(y_test, predictions)
y_test
is a DataFrame
which is of shape:
Horse | Dog | Cat
1 0 0
0 1 0
0 1 0
... ... ...
predictions
is a numpy array
:
[[1, 0, 0],
[0, 1, 0],
[0, 1, 0]]
I've searched a bit for the error message, but haven't really found something I could apply. Any hints?
No, your input to confusion_matrix
must be a list of predictions, not OHEs (one hot encodings). Call argmax
on your y_test
and y_pred
, and you should get what you expect.
confusion_matrix(
y_test.values.argmax(axis=1), predictions.argmax(axis=1))
array([[1, 0],
[0, 2]])