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. .NET Core 2.0 Cookie中间件 权限验证

    :在ConfigureServices添加Cookie中间件,使用自定义Scheme services.AddAuthentication(options=> { options.Default ...

  2. C# 用 * 输出两个等腰三角形组成的菱形

    int temp = 0; int n = 5; for(int i=0;i<n;i++){ for(int j=0;j<n-i;j++){ System.Console.Write(&q ...

  3. asp.net与C# path.GetFullPath 获取上级目录

    string path = new directoryinfo("../").fullname;//当前应用程序路径的上级目录 获取当前目录可以使用appdomain.curren ...

  4. C# 创建windows 服务

    1.      新建项目 1.1 右键解决方案 – 添加 – 新建项目 1.2 已安装模板 - windows  -  windows服务 – 输入名称 – 点击 ”确定” 2.      添加相应的 ...

  5. 【转载,整理】Linux性能监控

    一. 比较全的linux性能检测网站 1. 很好的网站,原文:http://os.51cto.com/art/201402/430050.htm 监测 cpu.内存.网络.IO等命令及工具   2.  ...

  6. mac 下python使用venv 虚拟环境

    1.安装virtualenv :pip3 install virtualenv 2.创建虚拟环境命令:virtualenv --no-site-packages venv 在当前目录创建一个虚拟环境v ...

  7. 3dmax,查看场景中所有材质

  8. xpath的常见操作

    1. 获取某一个节点下所有的文本数据: data = response.xpath('//div[@id="zoomcon"]') content = ''.join(data.x ...

  9. centos 7 下图形验证码乱码

    工作中遇到一个问题:同样的代码在centos 6.5下图形验证码是正常的 但是在centos 7下面是乱码 centos 6.5 的系统字体库目录 [wwwad@P2P-test2 fonts]$ p ...

  10. 2012版辅助开发工具包(ADT)新功能特性介绍及安装使用

    原文链接:http://android.eoe.cn/topic/android_sdk 2012年的Android辅助设备开发工具包(ADK)是Android开放设备协议(AOA)设备的最新参考实现 ...