https://datascience.stackexchange.com/questions/15989/micro-average-vs-macro-average-performance-in-a-multiclass-classification-settin/16001

Micro- and macro-averages (for whatever metric) will compute slightly different things, and thus their interpretation differs.

A macro-average will compute the metric independently for each class and then take the average (hence treating all classes equally), whereas a micro-average will aggregate the contributions of all classes to compute the average metric. In a multi-class classification setup, micro-average is preferable if you suspect there might be class imbalance (i.e you may have many more examples of one class than of other classes).

To illustrate why, take for example precision Pr=TP(TP+FP)Pr=TP(TP+FP). Let's imagine you have a One-vs-All(there is only one correct class output per example) multi-class classification system with four classes and the following numbers when tested:

  • Class A: 1 TP and 1 FP
  • Class B: 10 TP and 90 FP
  • Class C: 1 TP and 1 FP
  • Class D: 1 TP and 1 FP

You can see easily that PrA=PrC=PrD=0.5PrA=PrC=PrD=0.5, whereas PrB=0.1PrB=0.1.

  • A macro-average will then compute: Pr=0.5+0.1+0.5+0.54=0.4Pr=0.5+0.1+0.5+0.54=0.4
  • A micro-average will compute: Pr=1+10+1+12+100+2+2=0.123Pr=1+10+1+12+100+2+2=0.123

These are quite different values for precision. Intuitively, in the macro-average the "good" precision (0.5) of classes A, C and D is contributing to maintain a "decent" overall precision (0.4). While this is technically true (across classes, the average precision is 0.4), it is a bit misleading, since a large number of examples are not properly classified. These examples predominantly correspond to class B, so they only contribute 1/4 towards the average in spite of constituting 94.3% of your test data. The micro-average will adequately capture this class imbalance, and bring the overall precision average down to 0.123 (more in line with the precision of the dominating class B (0.1)).

Micro- and macro-averages的更多相关文章

  1. F1 score,micro F1score,macro F1score 的定义

    F1 score,micro F1score,macro F1score 的定义 2018年09月28日 19:30:08 wanglei_1996 阅读数 976   本篇博客可能会继续更新 最近在 ...

  2. 机器学习--Micro Average,Macro Average, Weighted Average

    根据前面几篇文章我们可以知道,当我们为模型泛化性能选择评估指标时,要根据问题本身以及数据集等因素来做选择.本篇博客主要是解释Micro Average,Macro Average,Weighted A ...

  3. Micro和Macro性能学习【转载】

    转自:https://datascience.stackexchange.com/questions/15989/micro-average-vs-macro-average-performance- ...

  4. 多分类评测标准(micro 和 macro)

  5. (转)Illustrated: Efficient Neural Architecture Search ---Guide on macro and micro search strategies in ENAS

    Illustrated: Efficient Neural Architecture Search --- Guide on macro and micro search strategies in  ...

  6. Java资源大全中文版(Awesome最新版)

    Awesome系列的Java资源整理.awesome-java 就是akullpp发起维护的Java资源列表,内容包括:构建工具.数据库.框架.模板.安全.代码分析.日志.第三方库.书籍.Java 站 ...

  7. Java Bloom filter几种实现比较

    英文原始出处: Bloom filter for Scala, the fastest for JVM 本文介绍的是用Scala实现的Bloom filter. 源代码在github上.依照性能测试结 ...

  8. 【Code Tools】Java微基准测试工具JMH之入门篇

    一.JMH是什么 JMH是一个Java工具,用于构建.运行和分析用Java和其他语言编写的以JVM为目标的 nano/micro/milli/macro 基准测试. 二.基本注意事项 1)运行JMH基 ...

  9. [转]awsome-java

    原文链接 Awesome Java A curated list of awesome Java frameworks, libraries and software. Contents Projec ...

  10. 多分类评价指标python代码

    from sklearn.metrics import precision_score,recall_score print (precision_score(y_true, y_scores,ave ...

随机推荐

  1. JAVA工程师面试常见问题集锦

    集锦一: 一.面试题基础总结 1. JVM结构原理.GC工作机制详解 答:具体参照:JVM结构.GC工作机制详解     ,说到GC,记住两点:1.GC是负责回收所有无任何引用对象的内存空间. 注意: ...

  2. Matlab函数

    any() 相当于或操作,只要有1,就返回1 all() 相当于与操作,只要有0,就返回0 C = union(A,B): C为A和B的并集.去掉相同元素. C = intersect(A,B) C为 ...

  3. laravel管理员表中的模型

    <?php namespace App; use App\Model; use Illuminate\Foundation\Auth\User as Authenticatable; class ...

  4. 尚学堂java 参考答案 第七章

    本答案为本人个人编辑,仅供参考,如果读者发现,请私信本人或在下方评论,提醒本人修改 一.选择题 1.ACD 解析:B:java中左边不能直接直接指定长度,和C语言不一样 2.B 3.C 解析:B各行分 ...

  5. java倒计时使用java.util.Timer实现,使用两个线程,以秒为单位

    public class Countdown3 { private int lin; private int curSec; public Countdown3(int lin)throws Inte ...

  6. Netty完成网络通信(二)

    Netty是基于NIO的框架,完善了NIO的一些缺陷,因此可以用Netty替代NIO Netty实现通信步骤: 1.创建两个NIO线程组,一个专门用于网络事件处理(接受客户端的连接),另一个则进行网络 ...

  7. 双引号与尖括号的区别 and 相对路径与绝对路径

    包含头文件的时候,如果包含的是自己写的头文件是用" " .如果是包含系统的头文件,一般用<>. 相对路径与绝对路径

  8. Maven 加载ojdbc14.jar报错,解决方法

    因为oracle的ojdbc.jar是收费的,所以maven的中央仓库中没有这个资源,只能通过配置本地库才能加载到项目中去. 首先下载 ojdbc14  https://pan.baidu.com/s ...

  9. java中的方法method

    java中的方法必须存在于类class里,不能独立存在.类是描述具有某种特征的事物,方法则是这类 事物具有的某种功能,通过调用方法可以实现某种特定的功能.方法名一般以小写的动词开头. 例: publi ...

  10. 十四. Python基础(14)--递归

    十四. Python基础(14)--递归 1 ● 递归(recursion) 概念: recursive functions-functions that call themselves either ...