lyst / lyst/lightfm

hybrid model inference with user features only no user id

Open
#549 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
5.1k
Forks
724
PR merge metrics
No merged PRs in 30d

Description

I appreciate the example in hybrid model in showing the difference in AUC. https://github.com/lyst/lightfm/blob/master/examples/stackexchange/hybrid_crossvalidated.ipynb

However, it would be very helpful if you could also show the difference in using user features only vs user features + user index for inference. I understand you're supposed to use 0 for user index for predicting with user features for new users.
`model.predict(0, np.arange(n_items), user_features=new_user_features)`. However, there are two ways of inputting data as noted in the build_user_feature function:
(user id, [list of feature names]) or (user id, {feature name: feature weight}).
So does that mean one should only provide (0,{feature name: feature weight}) (in my case) for inference for new user? I tried different ways. I'm getting identical recommendations for all new users. But I do get good recommendations if I provide user index with:
model.predict(dataset.mapping()[1][indx], np.arange(n_items))
The whole point of training a hybrid model is to infer with user features only for new users. I'm confused on how to input the new user features into predict. Also the sample_recommendation function requires user_ids in the quick start notebook.
https://github.com/lyst/lightfm/blob/master/examples/quickstart/quickstart.ipynb
Is there a demo for inferencing user features only and no user_ids needed?
Can someone shed some light on this? This has been difficult for a few days now. Thank you!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with examples/stackexchange/hybrid_crossvalidated.ipynb and examples/quickstart/quickstart.ipynb, focusing on build_user_feature, model.predict, and the sample_recommendation function. Clarify how to provide user features without a user ID and add a demonstration comparing user features only with user features plus a user index for new-user inference.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.