QinbinLi / MOON

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

Question about dirichlet non-iid #18

Closed boyufan closed 2 years ago

boyufan commented 2 years ago

Hi, thanks for your excellent work. I am confused about the construction of non-iid data using dirichlet distribution, which is located at line 126 in utils.py. What's the function of line 126? Could you please give me some intuition? I have no idea about what "len(idx_j) < N / n_parties" means. Thanks a lot!

boyufan commented 2 years ago

And I will appreciate if you can also explain the meaning of min_size and min_require_size

QinbinLi commented 2 years ago

Hi @boyufan ,

Line 126 is to reduce the quantity skew among different parties. If we find that the allocated number of instances is already larger than the average number, we do not allocate more instances to that party.

min_size and min_require_size are used to ensure that the minimum data size of parties is larger than min_require_size. Otherwise, we will re-allocate the instances.