日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Micro Average vs Macro average Performance in a Multiclass classification setting

發布時間:2025/3/15 编程问答 54 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Micro Average vs Macro average Performance in a Multiclass classification setting 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

整理摘自?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).?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.5?, whereas?PrB=0.1.

  • A macro-average will then compute:?Pr=0.5+0.1+0.5+0.54=0.4
  • A micro-average will compute:?Pr=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)).

當class-imblance已知,但仍要采用macro-average時,需要采取的措施:

1. 報告macro-average + standard deviation(標準差) (對于>=3的多分類任務)

2. 加權macro-average? (考慮樣本數的影響)

For computational reasons, it may sometimes be more convenient to compute class averages and then macro-average them. If class imbalance is known to be an issue, there are several ways around it. One is to report not only the macro-average, but also its standard deviation (for 3 or more classes). Another is to compute a weighted macro-average, in which each class contribution to the average is weighted by the relative number of examples available for it. In the above scenario, we obtain:

1. Prmacro?mean=0.25·0.5+0.25·0.1+0.25·0.5+0.25·0.5=0.4? ??

? ? Prmacro?stdev=0.173

2. Prmacro?weighted= 2/106 * 0.5 + 100 / 106 * 0.1 + 2 / 106 * 0.5 + 2 / 106 * 0.5

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? =?0.0189·0.5+0.943·0.1+0.0189·0.5+0.0189·0.5=0.009+0.094+0.009+0.009=0.123

The large standard deviation (0.173) already tells us that the 0.4 average does not stem from a uniform precision among classes, but it might be just easier to compute the weighted macro-average, which in essence is another way of computing the micro-average.

轉載于:https://www.cnblogs.com/shiyublog/p/9798870.html

總結

以上是生活随笔為你收集整理的Micro Average vs Macro average Performance in a Multiclass classification setting的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。