混淆矩阵预测标签
Confusion matrix predicted labels
我正在使用下面的一段 python 代码生成归一化混淆矩阵
import scikitplot as skplt
skplt.metrics.plot_confusion_matrix(y_test, y_pred, normalize=True)
这给了我如图所示的情节 here. However, I wanted to rotate the texs on the x-axis (the predicted values, i.e., neutral, happy, sad). Instead of in a horizontal line, I want the predicted values on the x-axis to be rotated (as shown in here) 并保持真实的标签(水平)。我们如何在 Python 中做到这一点?
如果你想使用 scikitplot,我相信 plot_confusion_matrix
function 中有 x_tick_rotation
参数。所以你可以旋转 xticks 到 45 度,如下所示。
skplt.metrics.plot_confusion_matrix(y_test, y_pred, x_tick_rotation=45, normalize=True)
我正在使用下面的一段 python 代码生成归一化混淆矩阵
import scikitplot as skplt
skplt.metrics.plot_confusion_matrix(y_test, y_pred, normalize=True)
这给了我如图所示的情节 here. However, I wanted to rotate the texs on the x-axis (the predicted values, i.e., neutral, happy, sad). Instead of in a horizontal line, I want the predicted values on the x-axis to be rotated (as shown in here) 并保持真实的标签(水平)。我们如何在 Python 中做到这一点?
如果你想使用 scikitplot,我相信 plot_confusion_matrix
function 中有 x_tick_rotation
参数。所以你可以旋转 xticks 到 45 度,如下所示。
skplt.metrics.plot_confusion_matrix(y_test, y_pred, x_tick_rotation=45, normalize=True)