联邦学习中的non-iid总结

最近研究联邦学习(federated learning,FL)中的non-iid的解决办法时遇到瓶颈,写成博客将最近的工作总结一下,希望有大佬看到这篇博客不吝赐教。

什么是non-iid

先从维基百科引出独立同分布的定义:

在概率论与统计学中,独立同分布(英语:Independent and identically distributed,缩写为IID)是指一组随机变量中每个变量的概率分布都相同,且这些随机变量互相独立。

一组随机变量独立同分布并不意味着它们的样本空间中每个事件发生概率都相同。例如,投掷非均匀骰子得到的结果序列是独立同分布的,但掷出每个面朝上的概率并不相同。

那么non-iid的意思即变量之间非独立,或者非同分布。

  • 非独立:对象之间存在关系。例如以某人的行为为随机变量,在某时刻观测到行为behavior1,某时刻观测到行为behavior2,这两个行为之间可能有某种联系。例如一个人走在路上,淋雨了(behavior1),撑开伞(behavior2),它们之间有时序关系。
  • 非同分布:两次观测的概率分布相同。例如某变量服从均匀分布,我们进行了一次观测;过一会服从正态分布,我们又进行了一次观测。这两次观测的变量就是非同分布

什么是FL中的non-iid

在联邦学习中,non-iid的意思一般是值不符合同分布的情况,因为数据的分布肯定是独立的,但是它们不一定服从同一采样方法。例如全集中有100类图片,某设备中都是风景类图片,某设备中都是人物类及植物类图片,前者是一种分布(1/100),后者是另一种分布(2/100)。反之,如果某设备中有这100类图片,其他设备中也有这100类图片,那么它们就是同分布的。看看下面的例子:

where we first sort the data by digit label, divide it into 200 shards of size 300, and assign each of 100 clients 2 shards. This is a pathological non-IID partition of the data, as most clients will only have examples of two digits. [1]

The training data are non-iid, that is, a device’s local data cannot be regarded as samples drawn from the overall distribution. The data available locally fail to represent the overall distribution. [2]

For the non-IID setting, each device still owns 600 samples, yet 80% of which come from a dominant class and the remaining 20% belong to other classes. For example, a “0”-dominated device has 480 data samples with the label “0”, while the remaining 120 data samples have labels evenly distributed among “1” to “9”[3]

For non-IID setting, the data is sorted by class and divided to create two extreme cases: (a) 1-class non-IID, where each client receives data partition from only a single class, and (b) 2-class non-IID, where the sorted data is divided into 20 partitions and each client is randomly assigned 2 partitions from 2 classes[4]

Non-identical client distributions:[5]

  • Feature distribution skew (covariate shift):同一类别,有不同的表现形式,如同样的数字,不同人的写法不一样
  • Label distribution skew (prior probability shift):同样的标签,有不同的表现形式,
  • Same label, different features (concept shift):
  • Same features, different label (concept shift)
  • Quantity skew or unbalanced:

可以发现它们的共同点:每个设备中的数据分布不能代表全局数据分布,即每个设备中类别是不完备的。可以任意设定哪些比例的设备拥有哪些比例类别的样本。例如10分类问题中,5%的设备有3类样本,10%的设备有5类样本,30%的设备有10类样本……哪些比例的设备、哪些比例的样本类别都是可以改变的参数,从而决定了non-iid的程度。此外,每个类别样本的数量也会影响non-iid程度,但数量上的不同一般描述为unbalanced。

如何衡量non-iid的程度

[2]给出了non-iid的一个评价方法,即全局目标函数的最小值与本地目标函数最小值之和。设想non-iid程度最小,即每个设备中分布都一样,那么本地目标函数最小值的加权和就是全局目标函数的最小值。现在由于non-iid从中作梗,每个本地目标函数优化方向都出了偏差,最小值是最适合本地那两类数据的(如手写数字1和2),它们加权平均在一起,不等于全局目标函数的最小值。

在这里插入图片描述
在这里插入图片描述
下图是异构程度的量化:
在这里插入图片描述
解释:

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值