SkLearn

Confusion Matrix

To be able to use this function do this:

from sklearn.metrics import confusion_matrix

Then, to use it on the code:

confusion_matrix(predicted_values,real_values)

Where both parameters are integer valued vectors. This will return an NxN array where N is the number of categories.

Classification report

To be able to use this function do this:

from sklearn.metrics import classification_report

To use in the code:

class_names = ['Class A','Class B',' Class C']
print(classification_report(real_values, predicted_values, target_names = class_names))