開始使用免費開始

從二元資料取得推薦結果

從 ROEM 可以看出,這些模型依然能產生有意義的測試預測。現在來看看實際的推薦結果。

pyspark.sql.functions 類別中的 col 函式已為你匯入。

本練習屬於課程

使用 PySpark 打造推薦引擎

檢視課程

練習說明

  • 已為你提供資料框 original_ratings。它包含使用者提供的原始評分。使用 .filter() 檢視使用者 26 的原始評分。
  • 同樣也提供了資料框 binary_recs。它包含每位使用者的推薦結果。使用 .filter() 檢視 userId == 26 的推薦。看起來是否與模型給出的推薦一致?
  • 對使用者 99 做相同操作。你也可以自由檢視其他使用者。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# View user 26's original ratings
print ("User 26 Original Ratings:")
____.____(col("userId") == 26).show()

# View user 26's recommendations
print ("User 26 Recommendations:")
binary_recs.filter(col("____") == 26).show()

# View user 99's original ratings
print ("User 99 Original Ratings:")
____.filter(____("userId") == 99).show()

# View user 99's recommendations
print ("User 99 Recommendations:")
binary_recs.filter(col("userId") == ____).show()
編輯並執行程式碼