简体   繁体   English

绘制混淆矩阵

[英]Plotting confusion matrix

I am trying to plot a confusion matrix usingscikitplot.metrics.plot_confusion_matrix by following snippet code-我正在尝试通过以下代码段使用scikitplot.metrics.plot_confusion_matrix来 plot 混淆矩阵-

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')

However, I am not quite getting the expected result as shown in the figure (somehow, the text is overlapping with the axis).但是,我并没有完全得到如图所示的预期结果(不知何故,文本与轴重叠)。 How can I make it neat and clean?我怎样才能使它整洁干净?

在此处输入图像描述

Firstly check the version of the matplotlib installed.首先检查安装的 matplotlib 的版本。 The problem is with the "imshow" function which scikitplot uses internally.问题在于 scikitplot 在内部使用的“imshow”function。 Until it gets fixed, please uninstall the present matplotlib version and install '3.0.3' version using following commands.在修复之前,请卸载当前的 matplotlib 版本并使用以下命令安装“3.0.3”版本。

pip uninstall matplotlib
pip install matplotlib=='3.0.3'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM