混淆矩阵预测标签

时间:2020-04-17 20:41:29

标签: python scikit-learn confusion-matrix scikit-plot

我正在使用以下python代码生成标准化的混淆矩阵

import scikitplot as skplt 
skplt.metrics.plot_confusion_matrix(y_test, y_pred, normalize=True)

,这给了我here所示的图。但是,我想在x轴上旋转tex(预测值,即中性,快乐,悲伤)。我希望不旋转水平线,而是旋转x轴上的预测值(如here所示),并保持真实标签(水平)不变。如何在Python中做到这一点?

1 个答案:

答案 0 :(得分:0)

如果您想使用scikitplot,我相信x_tick_rotation function中有plot_confusion_matrix个参数。因此,您可以按如下所示将xticks旋转到45度。

skplt.metrics.plot_confusion_matrix(y_test, y_pred, x_tick_rotation=45, normalize=True)