ibayer / fastFM

fastFM: A Library for Factorization Machines
http://ibayer.github.io/fastFM
Other
1.07k stars 206 forks source link

warm_start for SGD? #74

Open jylim2016 opened 7 years ago

jylim2016 commented 7 years ago

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!

josepablog commented 7 years ago

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

ibayer commented 7 years ago

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

josepablog commented 7 years ago

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?

jylim2016 commented 7 years ago

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

ibayer commented 7 years ago

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