guoguibing / librec

LibRec: A Leading Java Library for Recommender Systems, see
https://www.librec.net/
Other
3.24k stars 1.03k forks source link

Update FMSGDRecommender gradient equation #339

Closed sunbuhui closed 2 years ago

sunbuhui commented 3 years ago

image

Factorization Machines https://www.csie.ntu.edu.tw/~b97053/paper/Rendle2010FM.pdf

The old code implements gradient equation via run (if i !=j) everytime , so it will do this if-statement n time. According to the "Factorization Machines" paper's gradient equation part , we can sum them all and minus the redundant condition when i = j. It only computes twice.

I have done a small java test, it can faster the program surely when the 'n' is big. But i haven't done a unit-test in librec, i think the update is rather small, maybe it is not necessary. If it is needed, i will fill it soon.

sunbuhui commented 3 years ago

@wangyufengkevin I have checked the git commit log, it seems to be your code. Can you help me review it

sunbuhui commented 3 years ago

Definitely it's faster:)