【发布时间】:2018-10-28 23:52:18
【问题描述】:
我正在尝试在 python 中创建一个混淆矩阵。但是,如下图所示,我的班级标签彼此不匹配。我基本上希望 y 轴以 Tshirt/Top 开始,以 Ankle Boots 结束。这是我的代码:
test_labels = test_labels.argmax(axis=1)
predictions = predictions.argmax(axis=1)
cm = confusion_matrix(test_labels, predictions)
plt.setp(ax.xaxis.set_ticklabels(class_names), rotation=90, horizontalalignment='right')
plt.setp(ax.yaxis.set_ticklabels(class_names), rotation=360, horizontalalignment='right')
我是 python 新手,所以我不确定我做错了什么。
【问题讨论】:
-
您是否尝试过反转您的
y轴? -
尝试用rotation=180替换rotation=360
-
我已经玩过旋转了,它只是改变了文本标签的方向
标签: python matplotlib scikit-learn