Description Usage Arguments Examples
Plots the dendogram of a hierarchical clustering of the SOM prototypes.
1 | aweSOMdendrogram(clust, nclass)
|
clust |
an object of class 'hclust', the result of a hierarchical clustering performed by 'stats::hclust'. |
nclass |
number of superclasses |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Build training data
dat <- iris[, c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")]
### Scale training data
dat <- scale(dat)
## Train SOM
### Initialization (PCA grid)
init <- somInit(dat, 4, 4)
ok.som <- kohonen::som(dat, grid = kohonen::somgrid(4, 4, 'hexagonal'),
rlen = 100, alpha = c(0.05, 0.01),
radius = c(6.08,-6.08),
init = init, dist.fcts = 'sumofsquares')
## Group cells into superclasses (hierarchical clustering)
superclust <- hclust(dist(ok.som$codes[[1]]), 'complete')
## Plot superclasses dendrogram
aweSOMdendrogram(superclust, 2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.