NicolasHug / Surprise

A Python scikit for building and analyzing recommender systems
http://surpriselib.com
BSD 3-Clause "New" or "Revised" License
6.42k stars 1.02k forks source link

How can I get recommendations based on multiple items for a user-based engine? #414

Open ziyadmsq opened 2 years ago

ziyadmsq commented 2 years ago

I'm trying to build a user-based recommendation engine that takes multiple items that the user likes and then predicts more items based on it, is there a certain algorithm for that or a function?

for example get_recommendations([itemid1, itemid2, itemid3]) and then returns a list of items and the estimated rating or based on the nearest neighbors

Many thanks

NicolasHug commented 2 years ago

Hi @ziyadmsq , I'd suggest looking at our FAQ https://surprise.readthedocs.io/en/stable/FAQ.html, and possibly start with the getting-started guide: https://surprise.readthedocs.io/en/stable/getting_started.html

Techie5879 commented 2 years ago

Hi @ziyadmsq , I'd suggest looking at our FAQ https://surprise.readthedocs.io/en/stable/FAQ.html, and possibly start with the getting-started guide: https://surprise.readthedocs.io/en/stable/getting_started.html

I'm having a similar problem. The top_n_recommendations in FAQ helps us to predict ratings for a SVD model for users that are already in the trainset.

But I actually want to predict top-N recommendations for a new user that rates certain items and that gets passed to the model and it predicts the top N movies that this user can watch. What to do if the user isnt in the already-trained trainset??

EDIT: I found a way, but that was by creating a new pandas dataframe with the list of movies rated by users and then concatenating it to the full trainset, and building an anti_testset for that, and finally predicting on that. But seems computationally intensive (as I'm using model.test(anti_testset), which takes about 30 secs). Is there any alternative?

EDIT 2: This seems to give same recommendations no matter what items the user rates. So I'm stumped now