Skip to content
Advertisement

Suppress scientific notation in sklearn.metrics.plot_confusion_matrix

I was trying to plot a confusion matrix nicely, so I followed scikit-learn’s newer version 0.22’s in built plot confusion matrix function. However, one value of my confusion matrix value is 153, but it appears as 1.5e+02 in the confusion matrix plot: enter image description here

Following the scikit-learn’s documentation, I spotted this parameter called values_format, but I do not know how to manipulate this parameter so that it can suppress the scientific notation. My code is as follows.

JavaScript

Advertisement

Answer

Just remove “.format” and the {} brackets from your call parameter declaration:

JavaScript

In addition, you can use '.5g' to avoid decimal 0’s

Taken from source

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement