Session Ready
Exercise

KNN predictions

With the data in the correct shape from the last exercise, you can now use it to infer how user_001 feels about Apollo 13 (1995)

As a reminder, the data you prepared in the last exercise (and have been loaded into this one) are:

  • target_user_x - Centered ratings that user_001 has given to the movies they have seen.
  • other_users_x - Centered ratings for all other users and the movies they have rated excluding the movie Apollo 13.
  • other_users_y - Raw ratings that all other users have given the movie Apollo 13.

You will use other_users_x and other_users_y to fit a KNeighborsRegressor from scikit-learn and use it to predict what user_001 might have rated Apollo 13 (1995).

Instructions 1/2
undefined XP
  • 1
  • 2
  • Import KNeighborsRegressor from scikit-learn.
  • Instantiate the regressor as user_knn with the metric specified as cosine and \(k\) set to 10.