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.
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.