開始使用免費開始

PySpark MLlib 演算法

在 PySpark shell 中使用任何機器學習演算法之前,你需要先匯入 pyspark.mllib 函式庫的子模組,然後依據特定的機器學習任務選擇合適的類別。

在這個簡單的練習中,你會學到如何匯入 pyspark.mllib 的不同子模組,以及執行協同過濾、分類與分群演算法所需的類別。

本練習屬於課程

使用 PySpark 的 Big Data 基礎

檢視課程

練習說明

  • 匯入 pyspark.mllib 的 recommendation 子模組與 Alternating Least Squares 類別。
  • 匯入 pyspark.mllib 的 classification 子模組與 Logistic Regression with LBFGS 類別。
  • 匯入 pyspark.mllib 的 clustering 子模組與 kmeans 類別。

動手互動練習

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

# Import the library for ALS
from pyspark.mllib.____ import ____

# Import the library for Logistic Regression
from ____.____.____ import ____

# Import the library for Kmeans
from ____.____.____ ____ ____
編輯並執行程式碼