Sci-kit learn how to print labels for confusion matrix?

前端 未结 5 1618
孤城傲影
孤城傲影 2021-02-13 16:52

So I\'m using sci-kit learn to classify some data. I have 13 different class values/categorizes to classify the data to. Now I have been able to use cross validation and print t

5条回答
  •  [愿得一人]
    2021-02-13 17:29

    It appears your data has 13 different classes, which is why your confusion matrix has 13 rows and columns. Furthermore, your classes aren't labeled in any way, just integers from what I can see.

    If this isn't the case, and your training data has actual labels, you can pass a list of unique labels to confusion_matrix

    conf_mat = confusion_matrix(class_label, class_label_predicted, df['task'].unique())
    

提交回复
热议问题