Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plot_confusioin_matrix plot is not showing integer value instead it is showing some exponential value

Confusion Matrix

from sklearn.metrics import confusion_matrix
from sklearn.metrics import plot_confusion_matrix

print('*** Test Accuracy ***',forest.score(X_test,y_test))
disp = plot_confusion_matrix(forest, X_test, y_test,
                                 display_labels=[0,1],
                                 cmap=plt.cm.Blues,
                             values_format='g'
                            )

As one can see , inside the confusion matrix plot , the numbers printed is not integer . required is integer value to plot.

like image 425
Nabi Shaikh Avatar asked Mar 02 '23 20:03

Nabi Shaikh


1 Answers

You are instructing the format using values_format='g'. The format g favors using scientific notation when the numbers are large (as in your case)

try passing values_format='d' or values_format='.0f' instead

like image 77
Diziet Asahi Avatar answered Mar 05 '23 18:03

Diziet Asahi