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

Question about FedAvg code #2

Closed
Grassyue opened this issue Jul 6, 2021 · 3 comments
Closed

Question about FedAvg code #2

Grassyue opened this issue Jul 6, 2021 · 3 comments

Comments

@Grassyue
Copy link

Grassyue commented Jul 6, 2021

Thanks for sharing your code, it is an amazing work!
But I have a question on the implementation of FedAvg:

MOON/main.py

Line 587 in dbf6344

global_w[key] += net_para[key] * fed_avg_freqs[net_id]

why here aggregation without a "mean" operation ?

@QinbinLi
Copy link
Owner

QinbinLi commented Jul 7, 2021

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
Copy link
Author

Grassyue commented Jul 8, 2021

Thank you for your reply! 😃 @qiaojy19 @QinbinLi

@Grassyue Grassyue closed this as completed Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@QinbinLi @Grassyue and others