Is It Possible To Plot A Confusion Matrix With 90 Classes?
I wish to plot the confusion matrix for my classification model. It has about 20000 documents that need to be classified to 90 classes. The confusion matrix I receive is huge. I wi
Solution 1:
Here is some sample code using matplotlib (EDIT: added grid and switching off the interpolation)
import numpy as np
import matplotlib.pyplot as plt
confmat=np.random.rand(90,90)
ticks=np.linspace(0, 89,num=90)
plt.imshow(confmat, interpolation='none')
plt.colorbar()
plt.xticks(ticks,fontsize=6)
plt.yticks(ticks,fontsize=6)
plt.grid(True)
plt.show()
Solution 2:
Disclaimer,
Hi,
I think plotting a confusion matrix is not a good solution. I suggest you to save it as a html or csv file.
PyCM is a python module which can help you to show a multi-class confusion matrix through different types of reports such as a html report.
There is a simple code for saving a html report of a confusion matrix.
cm.save_html("file_name",color=(R,G,B))
Post a Comment for "Is It Possible To Plot A Confusion Matrix With 90 Classes?"