Prediction for Users with multiple items
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 724
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am trying to make a prediction for multiple users, while some users can have multiple items. When passing in the parameters to predict(user_ids, item_ids, item_features, user_features, num_threads), what should be the format for item_ids? For example, we have user-item pair (user_id=1, item_ids = [4,5,6]), (user_id=2, item_ids = [7,8,9]), should it be
predict([1,2], [[4,5,6],[7,8,9]], item_features, user_features, num_threads)? This is giving me
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in
4 [[4,5,6],[7,8,9]],
5 item_features=product_features_for_model,
----> 6 user_features=user_features_for_model)
~/opt/anaconda3/lib/python3.7/site-packages/lightfm/lightfm.py in predict(self, user_ids, item_ids, item_features, user_features, num_threads)
696
697 if isinstance(item_ids, (list, tuple)):
--> 698 item_ids = np.array(item_ids, dtype=np.int32)
699
700 assert len(user_ids) == len(item_ids)
ValueError: setting an array element with a sequence.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lightfm/lightfm.py's predict method, especially the item_ids conversion and length assertion shown in the traceback. Check the documented signature and examples for the supported user-item input shape; done means the format for multiple items per user and the reported ValueError are clearly addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100