层次聚类回顾

R 中的无监督学习

Hank Roark

Senior Data Scientist at Boeing

层次聚类回顾

# Fitting various hierarchical clustering models
hclust.complete <- hclust(d, method = "complete")
hclust.average <- hclust(d, method = "average")
hclust.single <- hclust(d, method = "single")
R 中的无监督学习

链接方法:完全与平均

完全链接与平均链接的树状图

R 中的无监督学习

层次聚类

R 中的无监督学习

迭代

迭代以获得更多簇

R 中的无监督学习

树状图

5 个簇与完成的树状图

R 中的无监督学习

k-means 与层次聚类的差异

k-means 与树状图

R 中的无监督学习

实践要点

# Scale the data
pokemon.scaled <- scale(pokemon)

# Create hierarchical and k-means clustering models
hclust.pokemon <- hclust(dist(pokemon.scaled), method = "complete")
km.pokemon <- kmeans(pokemon.scaled, centers = 3,
                     nstart = 20, iter.max = 50)

# Compare results of the models
cut.pokemon <- cutree(hclust.pokemon, k = 3)
table(km.pokemon$cluster, cut.pokemon)
cut.pokemon
    1   2   3
1 242   1   0
2 342   1   0
3 204   9   1
R 中的无监督学习

¡Vamos a practicar!

R 中的无监督学习

Preparing Video For Download...