Výběr počtu clusterů

Unsupervised Learning in R

Hank Roark

Senior Data Scientist at Boeing

Interpretace výsledků

# Create hierarchical cluster model: hclust.out
hclust.out <- hclust(dist(x))

# Inspect the result summary(hclust.out)
            Length Class  Mode     
merge       98     -none- numeric  
height      49     -none- numeric  
order       50     -none- numeric  
labels       0     -none- NULL     
method       1     -none- character
call         2     -none- call     
dist.method  1     -none- character
Unsupervised Learning in R

Dendrogram

  • Stromová struktura pro interpretaci hierarchických clusteringových modelů

pět pozorování a dendrogram

Unsupervised Learning in R

Dendrogram

  • Stromová struktura pro interpretaci hierarchických clusteringových modelů

dva body clusteru jsou spojeny v dendrogramu

Unsupervised Learning in R

Dendrogram

  • Stromová struktura pro interpretaci hierarchických clusteringových modelů

další dva body clusteru jsou spojeny v dendrogramu

Unsupervised Learning in R

Dendrogram

  • Stromová struktura pro interpretaci hierarchických clusteringových modelů

dva clustery a bod jsou spojeny v dendrogramu

Unsupervised Learning in R

Dendrogram

  • Stromová struktura pro interpretaci hierarchických clusteringových modelů

všechny clustery a body jsou spojeny v dendrogramu

Unsupervised Learning in R

Vykreslení dendrogramu v R

# Draws a dendrogram
plot(hclust.out)

abline(h = 6, col = "red")

vodorovná čára ukazující požadovaný počet clusterů v dendrogramu

Unsupervised Learning in R

„Řezání" stromu v R

# Cut by height h
cutree(hclust.out, h = 6)
1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3
3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 2 4 2 4 4
# Cut by number of clusters k
cutree(hclust.out, k = 2)
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2
2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1
Unsupervised Learning in R

Pojďme si procvičit!

Unsupervised Learning in R

Preparing Video For Download...