【发布时间】:2021-01-17 04:04:24
【问题描述】:
关于我的混淆矩阵布局的问题。我想将变量标签对应的数字“0”、“1”和“2”替换为“裸土”、“玉米”和“其他作物”的实际变量标签。 感谢您的帮助。
CM = confusion_matrix(y_test, y_pred)
CM = sns.heatmap(CM, square = True, cmap = "coolwarm", linewidths = .5, annot = True)
plt.title('Model confusion matrix', fontsize = 20)
plt.xlabel('Predict', fontsize = 15)
plt.ylabel('Real', fontsize = 15)
plt.show()
【问题讨论】:
-
您可以使用Panda,也可以使用plot_confusion_matrix。
标签: python dataframe layout label confusion-matrix