0

我正在尝试使用scikitplot.metrics.plot_confusion_matrix以下代码段来绘制混淆矩阵-

import scikitplot as skplt

Y_Test = [1, 0, 1, 0, 1, 1, 0, 1, 1 ,1 ,1, 1, 0, 0 ,0];
Y_Pred = [1, 0, 0, 0, 1, 1, 0, 1, 1 ,1 ,1, 1, 1, 0 ,0];
cm = skplt.metrics.plot_confusion_matrix(Y_Test,Y_Pred,normalize=True, text_fontsize = 'large')

但是,我并没有完全得到如图所示的预期结果(不知何故,文本与轴重叠)。我怎样才能使它整洁干净?

在此处输入图像描述

4

1 回答 1

0

首先检查安装的 matplotlib 的版本。问题在于 scikitplot 在内部使用的“imshow”函数。在修复之前,请卸载当前的 matplotlib 版本并使用以下命令安装“3.0.3”版本。

pip uninstall matplotlib
pip install matplotlib=='3.0.3'
于 2019-11-14T07:02:17.033 回答