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

前端 未结 5 1619
孤城傲影
孤城傲影 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:18

    Another better way of doing this is using crosstab function in pandas.

    pd.crosstab(y_true, y_pred, rownames=['True'], colnames=['Predicted'], margins=True).

    or

    pd.crosstab(le.inverse_transform(y_true), le.inverse_transform(y_pred),rownames=['True'], colnames=['Predicted'], margins=True)

提交回复
热议问题