Exercise

Comparing item-based and user-based models

You have now looked at two different KNN approaches. The first was item-item KNN where you use the average of the \(k\) most similar movies that a user has rated to suggest a rating for a movie they haven't watched. The other approach was user-user KNN where you use the average of the ratings that the \(k\) most similar users gave the movie to suggest what rating the target user would give the movie.

Now, you will compare the two and calculate what rating user_002 would give to Forrest Gump.

The code for the user_rating_predictor model (that predicts based on what similar users gave the movie), and the movie_rating_predictor (that predicts based off of what ratings this user gave to similar movies) has been started for you.

KNeighborsRegressor has been imported for you.

Instructions

100 XP
  • Create a user-user K-nearest neighbors model called user_knn.
  • Fit the user_knn model then predict on target_user_x.
  • Similarly, fit an item-item K-nearest neighbors model called movie_knn, then predict ontarget_movie_x.