開始使用免費開始

二元模型效能

你已經建立過好幾個 ALS 模型,所以這裡不再重複。課程已經針對 MovieLens 資料集的二元評分訓練好一個隱式 ALS 模型。現在來看看這個模型產生的 binary_test_predictions,看看能學到什麼。

我們已為你定義好 ROEM() 函式。若想了解更多用法細節,歡迎在主控台執行 help(ROEM)

本練習屬於課程

使用 PySpark 打造推薦引擎

檢視課程

練習說明

  • pyspark.sql.functions 類別匯入 col 函式。
  • 使用 .show() 方法檢視 binary_test_predictions,先了解資料長什麼樣子。
  • binary_test_predictions 呼叫 ROEM(),評估模型效能。你覺得表現如何?
  • 使用 .filter() 僅檢視使用者 42 的預測(col("userId") == 42)。你有發現什麼嗎?

動手互動練習

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

# Import the col function
from ____.sql.____ import ____

# Look at the test predictions
____.____()

# Evaluate ROEM on test predictions
____(____)

# Look at user 42's test predictions
binary_test_predictions.____(col("____") == ____).show()
編輯並執行程式碼