開始使用免費開始

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(____=____, ____=____)
編輯並執行程式碼