KNN Book Recommender

Tell us what’s happening:
I’ve adapted the solution for this exact problem from and I believe that my recommendations function is performing well but just doesn’t happen to yield all of the recommendations in the test. I’ve tried adjusting the K value as well as what data to use by filtering out books that do not meet a minimum rating count criteria but still I’m unable to pass the test. I’ve also tried stripping out all rows in the df_rating dataframe that had no ratings and that also did not work. Any suggestions on what I might be able to change to meet the requirements of this test would be appreciated. The one thing that I didn’t attempt to do at all from solution was to filter out users that were not from US or Canada but since the default workbook did not import the user data into a dataframe as it did with the other two files I assumed it was not needed for this project.

Your code so far
here is the link for my colab/jupyter notebook:

Your browser information:

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

Challenge: Book Recommendation Engine using KNN

Link to the challenge:

1 Like

Nevermind I figured it out. I didn’t find anything in the forums the last time I searched but in desperation I checked again and found an existing thread. I was able to get help based off of that thread. In the end there were really 3 things that were the cause of the varying results as compared to the test. The first thing was that following the solution was actually overkill (for the purposes of this project). It used only the books that received 50 or more ratings. The second issue/correction was based off of the feedback of the other thread where when I was attempting to drop the duplicates I wasn’t assigning the drop_duplicates() method to a variable so I guess it wasn’t actually executing. The third issue/correction was also based off of the sample code from the other thread where in the kneighbors() call. The K value I was using was between 1-10 but I guess it needed to be as large as the full length of unique titles i.e. len(piv.values)


thank you so much, i’ve stuck in this challenge for many days