1. 定义标签(labels)为0和1。
  2. 使用混淆矩阵函数(confusion_matrix)计算真实值(Y_test)和预测值(lr_pres)之间的混淆矩阵,并将结果赋值给变量cm。
  3. 使用Seaborn库中的热图函数(heatmap)将混淆矩阵可视化,设置参数annot为True以显示矩阵中的数字,设置annot_kws参数来控制数字的样式和颜色。
  4. 设置字体为Arial Unicode MS,字号为14。
  5. 设置图表标题为“混淆矩阵”,字号为20。
  6. 设置x轴标签为“Actual”,字号为14。
  7. 设置y轴标签为“Predict”,字号为14。
  8. 显示图表。
# 混淆矩阵热点图labels=01cm = confusion_matrixY_test lr_pres labelssnsheatmapcm annot = True annot_kws=size20weightbold colorbluepltrcfont family=Arial Unicode MS size=14plttitle混淆矩阵fontsize=20pltxlabelActua

原文地址: http://www.cveoy.top/t/topic/hssh 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录