taoqi98 / FedNewsRec

Data and code of our paper "Privacy-Preserving News Recommendation Model Learning"
MIT License
39 stars 14 forks source link

Parameter problems #7

Closed swbyy closed 2 years ago

swbyy commented 2 years ago

In the last cell of Ecample.ipynb, where do you use ratio? I don't find anywhere in your model where this parameter is used. What's more, what is the variable named num used for?

taoqi98 commented 2 years ago

Hi, thank you for pointing out this issue. First, the variable num'' is used for controlling the number of clients used for model training in a single federated training round. Second, the variableratio'' is designed for computing the variable num'', i.e., num = ratio*number_of_all_clients. In our codes, we forget to compute the variablenum'' via the variable ratio'', and directly set the variablenum'' to 6, which confuses you. We will fix this issue.

taoqi98 commented 2 years ago

Question from swbyy:

Thanks for your answers, sorry to bother you again, but I have successfully run your code and adjusted parameters according to those belonging to the paper. I have got 70+ outputs, but the results are not as good as in the paper which are almost all around (0.5030970471878436, 0.21842349985408516, 0.22200034188572945, 0.2848765577690094).Is this because the model has not yet converged? Or after how many times can the output effect reach what is described in the paper?

What‘s more, I discovered that in the last cell of Ecample.ipynb, lambd isn't used in def fed_single_update, did you misspell lambd as lr in "loss = fed_single_update(model,doc_encoder,user_encoder,ratio,lr,get_user_data,train_uid_table)"? And, in def fed_single_update I don't see a statement about updating the gradient g.

taoqi98 commented 2 years ago

I have checked my codes again. I found that the 4-th parameter passed to the function fed_single_update'' should be the parameterlambd'' instead of the parameter lr'' . The parameterlambd'' controls the intensity of the LDP noise, and this mistake will perturb the local model prediction with strong noise, which seriously hurt the model performance. In fact, the model can converge to 65 AUC after around 1000 rounds. I will fix this issue now.

In addition, since averaging local models and averaging local gradients are is mathematically equivalent, in our codes we did not explicitly compute the gradient. I will improve our codes according to your suggestions.