使用 PySpark 的 Big Data 基礎
Upendra Devisetty
Science Analyst, CyVerse
Machine learning is a scientific discipline that explores the construction and
study of algorithms that can learn from data
MLlib 是 Apache Spark 的機器學習元件
MLlib 提供的各式工具包含:
ML 演算法:協同過濾、分類、分群
特徵化:特徵擷取、轉換、降維、選擇
Pipeline:建構、評估、調校 ML Pipeline 的工具
Scikit-learn 是熱門的 Python 函式庫,用於資料探勘與機器學習
Scikit-learn 的演算法僅適用單機上的小型資料集
Spark 的 MLlib 演算法設計為可在叢集上平行處理
支援 Scala、Java、R 等語言
提供高階 API 以建構機器學習 Pipeline
分類(雙元與多類)與迴歸:Linear SVMs、logistic regression、decision trees、random forests、gradient-boosted trees、naive Bayes、linear least squares、Lasso、ridge regression、isotonic regression
協同過濾:Alternating least squares(ALS)
分群:K-means、Gaussian mixture、Bisecting K-means、Streaming K-Means
協同過濾(推薦引擎):產生推薦結果
分類:判定新觀測屬於哪個類別
分群:依相似特徵將資料分組
from pyspark.mllib.recommendation import ALS
from pyspark.mllib.classification import LogisticRegressionWithLBFGS
from pyspark.mllib.clustering import KMeans
使用 PySpark 的 Big Data 基礎