sklearn中的classification_report函数用于显示主要分类指标的文本报告.在报告中显示每个类的精确度,召回率,F1值等信息。 
主要参数: 
y_true:1维数组,或标签指示器数组/稀疏矩阵,目标值。 
y_pred:1维数组,或标签指示器数组/稀疏矩阵,分类器返回的估计值。 
labels:array,shape = [n_labels],报表中包含的标签索引的可选列表。 
target_names:字符串列表,与标签匹配的可选显示名称(相同顺序)。 
sample_weight:类似于shape = [n_samples]的数组,可选项,样本权重。 
digits:int,输出浮点值的位数.

    Parameters
----------
y_true : 1d array-like, or label indicator array / sparse matrix
Ground truth (correct) target values. y_pred : 1d array-like, or label indicator array / sparse matrix
Estimated targets as returned by a classifier. labels : array, shape = [n_labels]
Optional list of label indices to include in the report. target_names : list of strings
Optional display names matching the labels (same order). sample_weight : array-like of shape = [n_samples], optional
Sample weights. digits : int
Number of digits for formatting output floating point values Returns
-------
report : string
Text summary of the precision, recall, F1 score for each class. The reported averages are a prevalence-weighted macro-average across
classes (equivalent to :func:`precision_recall_fscore_support` with
``average='weighted'``). Note that in binary classification, recall of the positive class
is also known as "sensitivity"; recall of the negative class is
"specificity". Examples
--------
>>> from sklearn.metrics import classification_report
>>> y_true = [0, 1, 2, 2, 2]
>>> y_pred = [0, 0, 2, 2, 1]
>>> target_names = ['class 0', 'class 1', 'class 2']
>>> print(classification_report(y_true, y_pred, target_names=target_names))
precision recall f1-score support
<BLANKLINE>
class 0 0.50 1.00 0.67 1
class 1 0.00 0.00 0.00 1
class 2 1.00 0.67 0.80 3
<BLANKLINE>
avg / total 0.70 0.60 0.61 5
<BLANKLINE>

参考:

https://www.programcreek.com/python/example/81623/sklearn.metrics.classification_report

https://blog.csdn.net/akadiao/article/details/78788864

机器学习笔记,使用metrics.classification_report显示精确率,召回率,f1指数的更多相关文章

  1. 机器学习笔记--classification_report&精确度/召回率/F1值

    https://blog.csdn.net/akadiao/article/details/78788864 准确率=正确数/预测正确数=P 召回率=正确数/真实正确数=R F1 F1值是精确度和召回 ...

  2. 机器学习算法中的评价指标(准确率、召回率、F值、ROC、AUC等)

    参考链接:https://www.cnblogs.com/Zhi-Z/p/8728168.html 具体更详细的可以查阅周志华的西瓜书第二章,写的非常详细~ 一.机器学习性能评估指标 1.准确率(Ac ...

  3. 准确率、精确率、召回率、F1

    在搭建一个AI模型或者是机器学习模型的时候怎么去评估模型,比如我们前期讲的利用朴素贝叶斯算法做的垃圾邮件分类算法,我们如何取评估它.我们需要一套完整的评估方法对我们的模型进行正确的评估,如果模型效果比 ...

  4. 斯坦福大学公开课机器学习:machine learning system design | trading off precision and recall(F score公式的提出:学习算法中如何平衡(取舍)查准率和召回率的数值)

    一般来说,召回率和查准率的关系如下:1.如果需要很高的置信度的话,查准率会很高,相应的召回率很低:2.如果需要避免假阴性的话,召回率会很高,查准率会很低.下图右边显示的是召回率和查准率在一个学习算法中 ...

  5. 一文让你彻底理解准确率,精准率,召回率,真正率,假正率,ROC/AUC

    参考资料:https://zhuanlan.zhihu.com/p/46714763 ROC/AUC作为机器学习的评估指标非常重要,也是面试中经常出现的问题(80%都会问到).其实,理解它并不是非常难 ...

  6. 目标检测评价指标mAP 精准率和召回率

    首先明确几个概念,精确率,召回率,准确率 精确率precision 召回率recall 准确率accuracy 以一个实际例子入手,假设我们有100个肿瘤病人. 95个良性肿瘤病人,5个恶性肿瘤病人. ...

  7. 二分类算法的评价指标:准确率、精准率、召回率、混淆矩阵、AUC

    评价指标是针对同样的数据,输入不同的算法,或者输入相同的算法但参数不同而给出这个算法或者参数好坏的定量指标. 以下为了方便讲解,都以二分类问题为前提进行介绍,其实多分类问题下这些概念都可以得到推广. ...

  8. 正确率、召回率和 F 值

    原文:http://peghoty.blog.163.com/blog/static/49346409201302595935709/ 正确率.召回率和 F 值是在鱼龙混杂的环境中,选出目标的重要评价 ...

  9. 机器学习classification_report方法及precision精确率和recall召回率 说明

    classification_report简介 sklearn中的classification_report函数用于显示主要分类指标的文本报告.在报告中显示每个类的精确度,召回率,F1值等信息. 主要 ...

随机推荐

  1. 安卓sdk安装慢解决办法

    1.上图SDK Manager 的 Tools ->Options打开SDK Manager的Settings, 选中“Force https://… sources to be fetched ...

  2. 【Qt】StackedWidget

    一个简单的堆栈窗体类: 左側列表框会出现不同的选项,右側显示所选的不同的窗口 #include<QHBoxLayout> #include "stackdlg.h" S ...

  3. 如何修改电脑的本地网卡(非笔记本无限网卡)的mac地址

    计算机---设备管理器--找到对应的本地网卡---右键属性-----高级----网络地址

  4. [转]Jackson 解析json数据之忽略解析字段注解@JsonIgnoreProperties

    以前解析json用的惯的就是Google的gson了,用惯了基本就用它了,一直也没发现什么大问题,因为都是解析简单的json数据.但是最近学习springboot,要解析一个比较复杂的json数据.就 ...

  5. [转]PostgreSQL教程:系统表详解

    这篇文章主要介绍了PostgreSQL教程(十五):系统表详解,本文讲解了pg_class.pg_attribute.pg_attrdef.pg_authid.pg_auth_members.pg_c ...

  6. mongodb 数据库操作--备份 还原 导出 导入(转)

    mongodb 数据库操作--备份 还原 导出 导入   -------------------MongoDB数据导入与导出------------------- 1.导出工具:mongoexport ...

  7. CentOS 7 设置iptables防火墙开放proftpd端口

    由于ftp的被动模式是这样的,客户端跟服务器端的21号端口交互信令,服务器端开启21号端口能够使客户端登录以及查看目录.但是ftp被动模式用于传输数据的端口却不是21,而是大于1024的随机或配置文件 ...

  8. 服务端 https和SSL

    String keyStoreFilePassword = System .getProperty("keystore.file.password"); /usr/java/jdk ...

  9. Spring Cloud Consul

    1.2.0.RELEASE 该项目通过自动配置并绑定到Spring环境和其他Spring编程模型成语,为Spring Boot应用程序提供Consul集成.通过几个简单的注释,您可以快速启用和配置应用 ...

  10. [Windows Azure] What is a cloud service?

    What is a cloud service? When you create an application and run it in Windows Azure, the code and co ...