Machine Learning with Python Projects - Book Recommendation Engine using KNN

Tell us what’s happening:

Hello
my process of thinking:
take df_ratings, get count of users and isbn
if count of users is lower than 200, remove those rows
if count of isbn is lower than 100, remove those rows

now i have new filtered df_ratings_filtered
and here is where i need help

my idea is than i do pd.merge:

df_ratings_final = pd.merge(df_books, df_ratings_filtered, how ='right', on = 'isbn')

final df_ratings_final will now contain only isbn which were in df_rating_filtered, other are removed
also if some isbn is multiple times in df_rating_filtered (it should be, because it was rated multiple times), there should row for that:


columns= isbn, title,author, user, rating
isbn1, title1, author1, user1, 1
isbn1, title1, author1, user2, 5
isbn1, title1, author1, user3, 5
isbn2, title2, author1, user1, 5
isbn2, title2, author1, user4, 9
isbn2, title2, author1, user7, 0
... and so on

i will convert this data using preprocessing.LabelEncoder()
and then store those data and feed them to NearestNeighbors().fit(X)

this will do something but if i want to find nearest neighbors for specific book, my input should be that book, but in this case required input is entire row , which is probably not correct

i thing my solution should work if i used KNeighborsClassifier, but it seems that it is required to do it using NearestNeighbors

any idea how should i change my approach ?

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36

Challenge Information:

Machine Learning with Python Projects - Book Recommendation Engine using KNN

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.