KNN 预测
在上一个练习中,您已经把数据整理成了正确的形状,现在可以用它来推断 user_001 对电影 Apollo 13 (1995) 的看法。
回顾一下,您在上一个练习中准备的数据(已加载到本练习)包括:
target_user_x——user_001对其看过电影给出的中心化评分。other_users_x—— 其他所有用户对他们所评电影的中心化评分,且不包含电影 Apollo 13。other_users_y—— 其他所有用户对电影 Apollo 13 的原始评分。
您将使用 other_users_x 和 other_users_y 来训练 scikit-learn 中的 KNeighborsRegressor,并用它来预测 user_001 可能会给 Apollo 13 (1995) 打多少分。
本练习是课程的一部分
用 Python 构建推荐引擎
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Import the regressor
from sklearn.neighbors import ____
# Instantiate the user KNN model
user_knn = KNeighborsRegressor(____=____, ____=____)