Přehled hierarchického shlukování

Unsupervised Learning in R

Hank Roark

Senior Data Scientist at Boeing

Přehled hierarchického shlukování

# Fitting various hierarchical clustering models
hclust.complete <- hclust(d, method = "complete")
hclust.average <- hclust(d, method = "average")
hclust.single <- hclust(d, method = "single")
Unsupervised Learning in R

Metody propojení: complete a average

dendrogram s metodami complete a average

Unsupervised Learning in R

Hierarchické shlukování

Unsupervised Learning in R

Iterace

iterace pro získání více shluků

Unsupervised Learning in R

Dendrogram

5 shluků a hotový dendrogram

Unsupervised Learning in R

Rozdíly mezi k-means a hierarchickým shlukováním

k-means vs. dendrogram

Unsupervised Learning in R

Praktické poznámky

# 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
Unsupervised Learning in R

Pojďme si procvičit!

Unsupervised Learning in R

Preparing Video For Download...