總結與複習

R 的無監督式學習

Hank Roark

Senior Data Scientist at Boeing

個案研究總結

  • 使用非監督式學習的完整資料分析流程
  • 創意建模方法
  • 準備好解決真實世界問題
R 的無監督式學習

分群類型

k-means 與樹狀圖比較

R 的無監督式學習

降維

PCA 投影

R 的無監督式學習

模型選擇

# Initialize total within sum of squares error: wss
wss <- 0

# Look over 1 to 15 possible clusters
for (i in 1:15) {
  # Fit the model: km.out
  km.out <- kmeans(pokemon, centers = i, nstart = 20, iter.max = 50)
  # Save the within cluster sum of squares
  wss[i] <- km.out$tot.withinss
}

# Produce a scree plot
plot(1:15, wss, type = "b", 
     xlab = "Number of Clusters", 
     ylab = "Within groups sum of squares")
R 的無監督式學習

解讀 PCA 結果

雙變量圖與碎形圖

R 的無監督式學習

資料縮放的重要性

比較有縮放與未縮放的特徵重要性

R 的無監督式學習

課程複習

pr.iris <- prcomp(x = iris[-5],
                  scale = FALSE,
                  center = TRUE)
summary(pr.iris)
主成分的重要性:
                          PC1     PC2    PC3     PC4
Standard deviation     2.0563 0.49262 0.2797 0.15439
Proportion of Variance 0.9246 0.05307 0.0171 0.00521
Cumulative Proportion  0.9246 0.97769 0.9948 1.00000
R 的無監督式學習

樹狀圖(dendrogram)

樹狀圖

R 的無監督式學習

各演算法的優缺點

不同分群結果

R 的無監督式學習

課程複習

# Repeat for components 1 and 3
plot(wisc.pr$x[, c(1, 3)], col = (diagnosis + 1), 
     xlab = "PC1", ylab = "PC3")

主成分

R 的無監督式學習

精進你的技巧!

R 的無監督式學習

Preparing Video For Download...