Call predict() for every user, every item
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.1k
- Forks
- 724
- PR merge metrics
- No merged PRs in 30d
Description
Hello. I have been trying to use the LightFM predict function for every user and every item in the system. Essentially, my problems occur with supplying the input to predict, as I am unsure what kind of format user_ids and item_ids should take. My code is complex, so I'm going to supply simple examples.
Function definition:
`predict(user_ids, item_ids, item_features=None, user_features=None, num_threads=1)`
Suppose I want to get predictions for 10 users with ids [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] and 10 items with ids [0, 1, 2, 3, 4, 5, 6, 7, 8, 9].
How would I use predict() to get a prediction for every user-item interaction? The following attempts do not work (and numerous others I have tried):
1)
```
user_ids = np.arrange(10)
item_ids = np.arrange(10)
predict(user_ids, item_ids)
```
2)
```
user_ids = np.arrange(10)
item_ids = [ np.arrange(10) for i in range(10) ]
predict(user_ids, item_ids)
```
I am able to use predict inside of a for loop, such as
```
user_ids = np.arrange(10)
item_ids = np.arrange(10)
for i in user_ids:
predict(i, item_ids)
```
However, I would prefer to avoid this, as I can only imagine that calculating everything at once would be more efficient.
Once I figure this out, I will work on incorporating the features.
Thank you for your help!
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 the predict(user_ids, item_ids, item_features=None, user_features=None, num_threads=1) entry point and compare its expected input shapes with the two examples and the working loop. Done means clearly documenting how to request predictions for every user-item pair and how feature arguments fit into that usage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- machine-learning
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100