Multilabel-indicator is not supported for confusion matrix

前端 未结 3 1632
野性不改
野性不改 2020-12-05 18:35

multilabel-indicator is not supported is the error message I get, when trying to run:

confusion_matrix(y_test, predictions)

y

3条回答
  •  我在风中等你
    2020-12-05 19:13

    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]])
    

提交回复
热议问题