QinbinLi / MOON

Model-Contrastive Federated Learning (CVPR 2021)
MIT License
263 stars 56 forks source link

Question about FedAvg code #2

Closed Grassyue closed 3 years ago

Grassyue commented 3 years ago

Thanks for sharing your code, it is an amazing work! But I have a question on the implementation of FedAvg: https://github.com/QinbinLi/MOON/blob/dbf6344b15029ebce59e15053772a82fbed61d91/main.py#L587

why here aggregation without a "mean" operation ?

QinbinLi commented 3 years ago

Hi @Grassyue and @qiaojy19 ,

Yes, fed_avg_freqs[net_id] is the weight of each model. The weight is related to the data size of each party. The weights are not equal to 1/n if the data size of each party is different.

Grassyue commented 3 years ago

Thank you for your reply! :smiley: @qiaojy19 @QinbinLi