CommencerCommencer gratuitement

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).

Cet exercice fait partie du cours

Building Recommendation Engines in Python

Afficher le cours

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Import the regressor
from sklearn.neighbors import ____

# Instantiate the user KNN model
user_knn = KNeighborsRegressor(____=____, ____=____)
Modifier et exécuter le code