minks February 2016

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 wish to plot this but I only seem to find binary classification plots everywhere. Is it possible to plot this multi-class confusion matrix? I tried some methods but it does't display a clear one.

This is how my confusion matrix looks like:

[[3919  344    0 ...,    0    0    1]
 [ 267 2739    0 ...,    0    0    0]
 [   1    6   17 ...,    0    0    0]
 ..., 
 [   4    1    0 ...,    6    0    0]
 [   0    2    0 ...,    0    0    0]
 [   6    1    0 ...,    0    0   15]]

Answers


Shifty Scales February 2016

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()

enter image description here

Post Status

Asked in February 2016
Viewed 1,563 times
Voted 8
Answered 1 times

Search




Leave an answer