python使用sklearn绘制混淆矩阵

# 绘制多分类混淆矩阵
from sklearn.metrics import confusion_matrix
# probabilities为所有测试结果,yv为验证集Validation samples (images, labels)
cnf_matrix = confusion_matrix(np.argmax(yv, axis=1), np.argmax(probabilities,axis=1))
_ = print_confusion_matrix(cnf_matrix, selected_breed_list)
# 打印 Precision-Recall F1-Score的Report
from sklearn.metrics import classification_report

# support为这个类别有多少样本
report = classification_report(np.argmax(probabilities,axis=1), np.argmax(yv, axis=1), target_names=selected_breed_list)
print(report)

你可能感兴趣的:(深度学习,python,深度学习)