signed

QiShunwang

“诚信为本、客户至上”

senborn绘制混淆矩阵

2021/6/9 8:34:52   来源:

使用热力图绘制混淆矩阵:

import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

confuse_matrix = pd.DataFrame(np.random.randint(0, 100, size=(2, 2))) # 生成2*2的混淆矩阵
# plt.figure(figsize=(10, 10)) # 大小
sns.heatmap(confuse_matrix, annot=True, cmap="Blues", fmt='g')  # 画热力图
plt.show()