Suppress scientific notation in sklearn.metrics.plot_confusion_matrix
Simply pass values_format='' Example:
plot_confusion_matrix(clf, X_test, Y_test, values_format = '')
In case anyone using seaborn
´s heatmap
to plot the confusion matrix, and none of the answers above worked. You should turn off scientific notation in confusion matrix seaborn
with fmt='g'
, like so:
sns.heatmap(conf_matrix,annot=True, fmt='g')
Just remove ".format" and the {} brackets from your call parameter declaration:
disp = plot_confusion_matrix(logreg, X_test, y_test,
display_labels=class_names,
cmap=plt.cm.Greens,
normalize=normalize, values_format = '.5f')
In addition, you can use '.5g'
to avoid decimal 0's
Taken from source