plot confusion_matrix
import seaborn as sns
sns.set(font_scale=1.4) # y label 横向
import matplotlib.pyplot as plt'''
https://zhuanlan.zhihu.com/p/35494575
fmt ='.0%'#显示百分比
fmt ='f' 显示完整数字 = fmt ='g'
fmt ='.3'显示小数的位数 = fmt ='.3f' = fmt ='.3g'
'''confusion_matrix = pd.DataFrame(data = np.array([[99.9, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],[0.0, 99.9, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],[0.0, 0.0, 99.9, 0.0, 0.0, 0.0, 0.0, 0.0],[0.0, 0.0, 0.0, 99.9, 0.0, 0.0, 0.0, 0.0],[0.0, 0.0, 0.0, 0.0, 99.9, 0.0, 0.0, 0.0],[0.0, 0.0, 0.0, 0.0, 0.0, 99.9, 0.0, 0.0],[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 99.9, 0.0],[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 99.9]]),index = list(range(8)),columns = list(range(8)))f, ax = plt.subplots(figsize=(8,6))
df_cm = pd.DataFrame(confusion_matrix)
sns.heatmap(df_cm,annot=True,vmax=100.0,vmin = 0.0,fmt ='.1f',cmap = 'Greys',annot_kws={'size': 14})label_x = ax.get_xticklabels()
label_y = ax.get_yticklabels()
plt.setp(label_x, rotation=45, horizontalalignment='right',fontsize=16)
plt.setp(label_y, fontsize=16)plt.xlabel('Predicted Emotion',fontsize=20)
plt.ylabel('True Emotion',fontsize=20)plt.savefig('./fig_confusion_matrix_of_label_embedding_prediction.png')plt.show()
在这里插入图片描述
plot confusion_matrix相关推荐
- 【机器学习】用PyCaret创建整个机器学习管道
作者 | Daniel Morales 编译 | VK 来源 | Towards Data Science 本教程涵盖了整个ML过程,从数据获取.预处理.模型训练.超参数拟合.预测和存储模型以备将来使 ...
- PyCaret 2.0在这里-新增功能?
There's no doubt that PyCaret is my favorite machine learning library. It's more developer-friendly ...
- python模型部署方法_终极开箱即用的自动化Python模型选择方法
python模型部署方法 Choosing the best model is a key step after feature selection in any data science proje ...
- pycaret实现CTG分类案例
import numpy as np import pandas as pd import warnings warnings.filterwarnings("ignore") # ...
- sklearn基于make_scorer函数为Logistic模型构建自定义损失函数并可视化误差图(lambda selection)和系数图(trace plot)+代码实战
sklearn基于make_scorer函数为Logistic模型构建自定义损失函数并可视化误差图(lambda selection)和系数图(trace plot)+代码实战 # 自定义损失函数 i ...
- Python混淆矩阵(confusion_matrix)FP、FN、TP、TN、ROC,FROC,精确率(Precision),召回率(Recall),准确率(Accuracy),F1分数详述与实现
目录 一.FP.FN.TP.TN 二.准确率(Accuracy).精确率(Precision).召回率(Recall).F1score 2.1.准确率(Accuracy) 2.2.召回率(Recall ...
- Python的知识点 plt.plot()函数细节
20201228 lw 是line width 线的宽度 1.plt.plot(x,y,format_string,**kwargs) 转自点击打开链接 x轴数据,y轴数据,format_strin ...
- pycharm中报错:Error: failed to send plot to http://127.0.0.1:63342
pycharm中报错:Error: failed to send plot to http://127.0.0.1:63342 import matplotlib.pyplot as plt impo ...
- matlab数据可视化总结,机器学习----Matlab数据可视化总结(plot篇)
前言 通过资料的整理,使用Matlab语言的plot函数将数据可视化,plota函数也是一个比较常用的二维绘图函数,针对向量或矩阵.如果你也想试一试,初学者记得使用clf.close或close al ...
- matlab plot不均匀间隔,matplotlib如何绘制间隔为2^n的不均匀图形?
如果我的意见不够清楚,请你问.:)from matplotlib import pyplot as plt # Instanciating my lists... f = lambda x:x**2 ...
最新文章
- NLP公开课 | 竹间智能翁嘉颀:人机交互未来如何改变人类生活
- 计算机科学与技术python方向是什么意思-大学计算机科学与技术相关专业学习路线...
- 使用Sass预定义一些常用的样式,非常方便(转)
- qdu-凑数题(01背包)
- 证明CLIQUE(团问题)是NP完全
- 白帽子讲Web安全(纪念版)笔记
- 解决win10声卡驱动不兼容问题和成功安装战神k650-i5-d2上的Sound Blaster Cinema2在win10系统上
- python画风羽及风羽定义
- 信用卡刷卡消费背后的故事
- 【CodeForces】 106C Buns(多重背包)
- 【我Linux服务器被ddos了】记一次ddos防御+溯源+反击
- uos系统桌面怎么没有计算机图标,UOS系统体验:启动、桌面和开始菜单
- fedora14安装出错
- utils util
- php 索引数组应用实例,php数字索引数组实例用法总结
- shell 经典, shell 十三问
- 并发(concurrency)和并行(parallelism)的区别
- 由生至死,众安「步步鸡」将鸡的一生安排得明明白白
- DSP实验报告三:AWGN 信道中 BPSK 及 QPSK 系统仿真
- [转]caoz写的关于系统分析的文章