aweSOMsilhouette: Silhouette plot of SOM superclasses

View source: R/plots.R

aweSOMsilhouetteR Documentation

Silhouette plot of SOM superclasses

Description

Plots a silhouette plot, used to assess the quality of the super-clustering of SOM prototypes into superclasses. Available for both PAM and hierarchical clustering.

Usage

aweSOMsilhouette(som, clust)

Arguments

som

kohonen object, a SOM created by the kohonen::som function.

clust

object containing the result of the super-clustering of the SOM prototypes (either a hclust or a pam object).

Value

No return value, called for side effects.

Examples

## 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(2.65,-2.65), init = init,
                       dist.fcts = 'sumofsquares')
## Group cells into superclasses (PAM clustering)
superclust <- cluster::pam(ok.som$codes[[1]], 2)
superclasses <- superclust$clustering
aweSOMsilhouette(ok.som, superclasses)

aweSOM documentation built on Aug. 30, 2022, 5:05 p.m.