massquantity / LibRecommender

Versatile End-to-End Recommender System
https://librecommender.readthedocs.io/
MIT License
352 stars 62 forks source link

Scores along with Ranked List of Items #424

Closed chiragdaryani closed 9 months ago

chiragdaryani commented 9 months ago

Hi, my training data includes implicit feedback, specifically in the form of past purchases. After training the models, I not only need the ranked list of top n recommendations for each user but also the underlying scores used for ranking.

The function model.recommend_user(user=user_id, n_rec=n) provides the rank but not the scores. Is there a way we can obtain both the scores and the ranked list?

massquantity commented 9 months ago

Hi, there is no direct way of achieving this, but u can use the predict function to get scores after getting the ranked list. The predict function accepts a batch of users/items.

model.predict(user=[1, 1, 1], item=[1, 2, 3])
chiragdaryani commented 9 months ago

Thank you for your prompt response. This should suffice for my needs.