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. mongodb3.4 安装及用户名密码设置

    下载: https://www.mongodb.com/download-center?jmp=nav#community 1.解压  修改文件名为mongo3.2.5,执行命令如下: mv mong ...

  2. js 万恶之源 是否滚动到底部?

    let scrollHandle = (el) => { // 如果已经滚到底部了 if (el.scrollHeight - el.scrollTop === el.clientHeight) ...

  3. java项目中显示图表:struts2整合jfreechart

    需要的包: struts2-jfreechart-plugin-2.2.1.1.jar jfreechart-1.0.13.jar jcommon-1.0.17.jar 前台jsp页面中可以使用ifr ...

  4. iphone 4s插件的安装,问题及美化

    此处iphone4s为美版,系统版本为5.0.1 首先添加我自己的weiphone源:http://apt.weiphone.com/u/2903862以及破解资源源:http://cydia.xse ...

  5. react-native 入门教程

    http://blog.csdn.net/a_zhon/article/category/7170315 几篇文章看下来基本就入门了

  6. 自动化无线网破解工具wifite2

    自动化无线网破解工具wifite2 wifite是一款自动化wifi密码破解工具,特点是支持多个wep.wpa加密的wifi网络,不支持windows和osx. wifite的特点是可以同时攻击多个采 ...

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

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

  8. 【Android开发】构建Android源码编译环境

    原文:http://android.eoe.cn/topic/android_sdk 构建Android源码编译环境 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ...

  9. 模态推出 全屏 隐藏tabbar

    SearchVC * vc = [[SearchVC alloc] init]; /* 底部向上  UIModalTransitionStyleCoverVertical // 淡入     UIMo ...

  10. mysql数据库TINYINT取值范围详解

    分享下mysql中TINYINT的取值范围,很基础的一些内容. 在MySQL的数据类型中,Tinyint的取值范围是:带符号的范围是-128到127.无符号的范围是0到255(见官方<MySQL ...