Adding new ratings and new user and re-training model
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 add the new user with new ratings to the model and retrain it but I am not sure how to do this; I have tried adding the new user to the .csv files that I open, hoping that it will train again on those but I keep getting the embedding error. I would like to add couple of new ratings for a user that is also not in the data set, as in: new_user=[book_id:rating, book_id:rating...]Any help would be appreciated! Thank you!
Here is my model:
```
def get_recommendations(model, coo_mtrx, users_ids, books_id):
n_items = coo_mtrx.shape[1]
# TODO create known positives
# Books the model predicts they will like
scores = model.predict(users_ids, np.arange(n_items))
top_scores = np.argsort(-scores)[:5]
print ('Book recomendations:')
for x in top_scores.tolist():
print(books_id[str(x)])
def main():
#format_files()
data = book(min_score=2)
model = LightFM(loss='warp')
model.fit(data['matrix'], epochs=30, num_threads=2)
# model.fit_partial()
user = '1996'
get_recommendations(model, data['matrix'], user, data['books_id'])
if __name__ == "__main__" :
main()
```
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 at main and get_recommendations, then inspect the LightFM fit and fit_partial calls and the data['matrix'] passed to them. Done means documenting or implementing a clear workflow for adding a user with new ratings and obtaining recommendations without the reported embedding error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100