Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combining Ensembles and Data Augmentation can Harm your Calibration #18

Open
Akasuyi opened this issue Jul 23, 2021 · 0 comments
Open

Comments

@Akasuyi
Copy link
Collaborator

Akasuyi commented Jul 23, 2021

这篇论文发现了一个有意思的现象,如果同时使用ensemble以及data augmentation,虽然可以提升模型的准确度,但是会损害模型的calibration,进一步实验发现,如果使用ensemble以及data augmentation且data augmentation使用soft-label类的方法,会使得模型的calibration下降,遂本文提出了一种新的data augmentation的方法CAMixup’s来改善这种现象。

复制到markdown编辑器以获取更好的阅读体验

论文信息

  • 主要作者:Boxin Wang
  • 单位:University of Illinois at Urbana-Champaign & Microsoft Dynamics 365 AI Research & Virginia Tech
  • 论文链接

1 如何衡量calibration

当处理分类任务时,如果模型认为数据a为A类别的可能性虽然相较于其他类别来说是最大的,但数值上来看,是A类别的概率并不是很大,且该数据确实是A类别的,模型对此结果并不是那么“确定”,模型的calibration就会偏低。

本文对模型的calibration进行近似计算,使用了ECE(Expected Calibration Error)方法:

将模型分类的结果,按每个模型预测出的标签的可能性大小排序,然后分入$M$个“桶”里,在这$M$个桶里面,分别计算模型的分类正确的标签数以及所有分类正确的标签的概率大小之和,再计算每个桶里面的这两个结果之差的绝对值,将每个桶的结果相加。如果模型的calibration很高,模型预测的准确率越高就说明模型对分类这些结果更为自信,它分类这些标签的可能性大小就应该越高。计算式子如下:

PS @ KF{QCF8JPV509(57CT
9_U5`OT046NH$3S~BJ2 H83
4ZV{V3)O3O~9M( 4BZ_M {B

$$ Acc(B_{m}) = \frac{1}{|B_{m}|}\sum_{x\in B_{m}}\mathbf {1}(\hat{y_{i}}=y_{i}) $$

$$ Conf(B_{m}) = \frac{1}{|B_{m}|}\sum_{x\in B_{m}}\hat{p_{i}} $$

$$ ECE = \sum_{m=1}^M \frac{|B_{m}|}{n}|Acc(B_{m})-Conf(B_{m})| $$

2 实验以及实验分析

实验的条件

数据集:CIFAR-10/CIFAR-100

模型:WideResNet 28-10

测试的ensemble的方法:BatchEnsemble (BE), MC-dropout (MC), and deep ensembles (DE)

实验的结果

对于测试中所有的ensemble方法来说,ensemble和mixup(data augmentation的一种方法)一起使用还不如单独使用ensemble方法的calibration高(虽然模型准确性提升了),ensemble与mixup方法一起使用会降低模型的calibration

补充实验

另外,论文中还进行了两项补充实验(1 观察使用或不使用ensemble和data augmentation的各模型,前述不同桶中的$Acc$以及$Conf$之差进行比较,如果$Acc$的值比$Conf$的值更大,说明模型是under-confidence的,而ensemble和mixup一起使用时,会降低模型的confidence,从而导致calibration也下降。

(2 label smoothing方法也与mixup一样,会降低,所以论文推测,是因为本身ensemble就会给模型带来不确定性的要素,而如果再让模型使用data augmentation,会进一步加剧模型对类别的不确定性,但是标签本身是类别分明的,从而导致模型对本来已经较为确定的标签又变得不确定了。

3 CAMixup‘s的主要思想

只对复杂的类别使用mixup,而对简单的类别不使用mixup方法

如何判断类别简单还是复杂:使用前面的公式来对每个类别的$Acc$以及$Conf$进行计算,只有某一类别的$Acc$比$Conf$小,才使用mixup来产生新的数据

4 使用CAMixup‘s的结果

使用前述的数据集以及模型,大部分结果的准确率有小小的损失,但是使用ECE衡量的calibration的损失减少了很多。

5 在你认知范围内,哪些其它任务可以尝试

只要是分类任务,如果有提高calibration的需求,都可以使用

6 好的句子

By averaging predictions, ensembles can rule out individual mistakes

Fig. 6b also shows that CAMixup’s calibration on out-of-distribution data (CIFAR-10-C) is also on par with Mixup ensembles.

To our surprise, we find that augmentation techniques can be detrimental to ensemble calibration.

For a detailed analysis, we identify a compounding under-confidence, where Mixup’s soft labels (and more broadly, label-based augmentation strategies introduce a negative confidence bias that hinders its combination with ensembles.

Contrary to existing wisdom in the literature, we find that combining ensembles and Mixup consistently degrades calibration performance across three ensembling techniques.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant