CharlieDinh / pFedMe

Personalized Federated Learning with Moreau Envelopes (pFedMe) using Pytorch (NeurIPS 2020)
290 stars 88 forks source link

Something maybe wrong in data/mnist/generate_niid_20users.py #15

Closed tjuxiaofeng closed 3 years ago

tjuxiaofeng commented 3 years ago

I think the code "l = (user NUM_USERS + j) % 10" in line 39 should be modified to "l = (user NUM_LABELS + j) % 10". Using "user * NUM_USERS" will cause all users to share a data set with the same label, because *user NUM_USERS% 10 = 0.**

Fruit0218 commented 8 months ago

Definitely, I got the same question as yours. I found that if I change NUM_LABELS(num_labels_per_users) into 2, then all users will share label 0&1, I think this is the key point that can't match non-iid scenario. Actually, I try to run this code with different models many times, however, it seems that FedAvg did better than pFedMe, I do doubt this cause my conundrum :(