联盟学习中的客户大小不平衡
我使用Federated的Tensoflow在多个文件上应用联合学习。问题是,每个文件中的数据大小(记录数)不同。
- 在联合学习培训中,每个客户的大小都不同吗?如果有如何克服它?
- 有没有办法可以看到每个客户在联合计算培训时的表现?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我使用Federated的Tensoflow在多个文件上应用联合学习。问题是,每个文件中的数据大小(记录数)不同。
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
在联合学习培训中,每个客户的大小都不同吗?如果有如何克服它?
这取决于多种因素,很大的是客户的数据分布。例如,如果每个客户的数据看起来非常非常相似(例如,有效地相同的分布,)使用哪个客户端并不重要。
如果不是这种情况,那么一种常见的技术是限制客户在每个回合中对数据集采取的最大步骤的数量,以促进更多平等的参与培训过程。在TensorFlow和TFF中,可以使用 限制最大迭代次数。在TFF中,这可以使用 tff.simulation.datasets.clientdata.preprocess 。在教程中与示例进行了讨论。
有没有办法可以看到每个客户在联合计算培训时的表现?
客户可以返回单个指标以报告其表现方式,但默认情况下不是这样做的。在
metrics_aggregator
默认为tff.learning.metrics.sum_then_finalize
通常会创建全局指标平均值。没有开箱即用的解决方案,但是可以实现“最终确定”,然后可以满足这一需求。 re-using 并查看源代码对于sum_then_finalize
作为一个例子,将是一个不错的起点。Is it a problem in federated learning training to have different sizes for each client? if there is how can I overcome it?
This depends on a variety of factors, a large one being the data distribution on the clients. For example, if each clients data looks very similar (e.g. effectively the same distribution, IID) it doesn't particularly matter which client is used.
If this isn't the case, a common technique is to limit the number of maximum steps a client takes on its dataset each round, to promote more equal participation in the training process. In TensorFlow and TFF this can be accomplished using
tf.data.Dataset.take
to restrict to a maximum number of iterations. In TFF this can be applied to every client usingtff.simulation.datasets.ClientData.preprocess
. This is discussed with examples in the tutorial Working with TFF's ClientData.Is there a way that I can see how each client performing while federated computation training?
Clients can return individual metrics to report how they are performing, but this isn't done by default. In
tff.learning.algorithms.build_weighted_fed_avg
themetrics_aggregator
defaults totff.learning.metrics.sum_then_finalize
which in usually creates global averages of metrics. There isn't an out-of-the-box solution, but one could implement a "finalize-then-sample" that would likely meet this need. Re-usingtff.aggregators.federated_sample
and looking at the source code forsum_then_finalize
as an example would be a good place to start.对于选择培训和测试的文件:
通常,使用了70-80%的培训数据以及剩余的20-30%用于测试的数据。因此,选择用于培训和测试的文件以接近3:1的比率。
For choosing files for training and testing:
In general, 70-80% of data for training and the remaining 20-30% of data for testing are used. So, select the files for training and testing to have a ratio closer to 3:1.