0

how to make a figure of confsuion matrix done with sklearn bigger, in a way to wrapp all the numbers ina a normal way and not like my result. Hier is my code:




         import sklearn
         import numpy as np
         from mlxtend.plotting import plot_confusion_matrix
         import matplotlib.pyplot as plt

         y_pred = model.predict(X_test)
         Y_pred_classes = np.argmax(y_pred,axis=1) 
         Y_true = np.argmax(Y_test,axis=1)
         confusion_mtx = sklearn.metrics.confusion_matrix(Y_true, Y_pred_classes) 
         plot_confusion_matrix(confusion_mtx, class_names = allCategories() )

the figure don t fit the matrix

  • Check out [this post](https://stackoverflow.com/questions/56942670/matplotlib-seaborn-first-and-last-row-cut-in-half-of-heatmap-plot). It's a bug in `matplotlib 3.1.1` that causes that. – Chris Adams Mar 13 '20 at 13:37
  • If you don't understand looking at that topic, it's this line you have to add before plotting: `plt.figure(figsize=(10,5))`. Adjust the height, width be replacing the 10 and 5. – mrbTT Mar 13 '20 at 13:51

0 Answers0