简体   繁体   中英

Plotting confusion matrix

I am trying to plot a confusion matrix usingscikitplot.metrics.plot_confusion_matrix by following snippet code-

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. The problem is with the "imshow" function which scikitplot uses internally. Until it gets fixed, please uninstall the present matplotlib version and install '3.0.3' version using following commands.

pip uninstall matplotlib
pip install matplotlib=='3.0.3'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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