lyst / lyst/lightfm

Do momentum and gradients required for predictions?

Open
#656 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.1k
Forks
724
PR merge metrics
No merged PRs in 30d

Description

Method `_check_initialized()` called on each prediction methods call. It checks that embeddings, biases, gradients and momentum are set while only embeddings and biases are used for predictions. Do we really require gradients and momentum for predictions?
https://github.com/lyst/lightfm/blob/master/lightfm/lightfm.py#L262-L273
https://github.com/lyst/lightfm/blob/master/lightfm/lightfm.py#L259

IMO we can clean up momentums and gradients to minimize memory usage to use the model only for inference.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lightfm/lightfm.py at _check_initialized() and the prediction methods around lines 259-273. Trace which model attributes prediction actually uses, then define and verify the inference state so gradients and momentum can be cleaned up without preventing predictions or increasing required memory.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.