Python MML Book Recommendation Project

Hey all,

I am working on this book recommendation project. I think I almost have it but I am still not getting the correct output. Would anyone mind checking out my Google colab link and giving some feedback on why it isn’t working? Thanks

My apologies. I just edited the settings, now you should be able to view. Here’s a new link

Your program does work, only not fulfiling all the requirements. Three points can be done:

  1. In cell #4, the two filtering actions need to do at the same time, therefore need to use a single statement( with the two conditions linked by ‘and’) instead of two.

dset = df_ratings[(~df_ratings[‘user’].isin(user_counts[user_counts < 200].index))]
dset = df_ratings[~df_ratings[‘isbn’].isin(isbn_counts[isbn_counts < 100].index)]

  1. As one of the recommended books return by NearestNeighbors is the inputed book itself, if we need 5 recommended books other than the original one, n_neighbors need to be set as 6,

  2. Notice the layouts of the example and testing function, which require the order of the recommended books list to be reversed.

If anyone is curious as to how I solved my problems. In cell 4 I was using df_ratings instead of the new dset to get rid of the ISBNs with less than 100 ratings. It had nothing to do with ‘and’ statements.

Also, I made n_neighbors equal to 6 instead of 5 as SzeYeung1 suggested. I then changed the range of my for loop in the get_recommends function to go from 5 to 0 incrementing by -1 and that reversed my list. It works now!

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