fastFM icon indicating copy to clipboard operation
fastFM copied to clipboard

warm_start for SGD?

Open jylim2016 opened this issue 9 years ago • 5 comments

While going through the source code, I notice that there isn't a warm_start option for the SGD classifier, while ALS has it. Such an option would be useful for online learning with SGD. Is there a reason for not having it?

Cheers!

jylim2016 avatar Nov 01 '16 11:11 jylim2016

Where did you see the warm_start option? I'm trying to see if I can use this library for online updates : )

josepablog avatar Nov 02 '16 00:11 josepablog

@josepablog The option is used in this example: http://ibayer.github.io/fastFM/guide.html#learning-curves

@jylim2016 No technical reason that I'm aware of. Contributions are welcome.

ibayer avatar Nov 02 '16 08:11 ibayer

Thank you for the reference. This is pretty cool.

As it is implemented, this would require some work for implementing online updates -- when there's some observations for a new user (not observed previously). Right?

josepablog avatar Nov 02 '16 18:11 josepablog

@ibayer Thanks for the clarification!

@josepablog I made some changes to fastFM/fastFM/ffm.pyx within the function ffm_sgd_fit -- by adding the if fm.warm_start .. else block (similar to ffm_als_fit) and recompiing the library. For online updates, I made the following calls: fm.warm_start = True fm.fit(X_train, y_train) ...and that seemed to work.

jylim2016 avatar Nov 03 '16 07:11 jylim2016

@jylim2016 Can you open a pull request with your changes?

ibayer avatar Nov 03 '16 08:11 ibayer