What do you want to save?
Add Code snippet
New code examples
-
Python 2021-11-19 19:27:14
accuracy for each class
from sklearn.metrics import confusion_matrix import numpy as np y_true = [0, 1, 2, 2, 2] y_pred = [0, 0, 2, 2, 1] target_names = ['class 0', 'class 1', 'class 2'] #Get the confusion matrix cm = confusion_matrix(y_true, y_pred) #array([[1, 0, 0], # [1,... Add solution
Best helpers
Ranking is empty