Description Usage Arguments Details Examples
Plots a visualization of the distances between the SOM cells. Based on the U-Matrix, which is computed for each cell as the mean distance to its immediate neighbors.
1 2 3 4 5 6 | aweSOMsmoothdist(
som,
pal = c("viridis", "grey", "rainbow", "heat", "terrain", "topo", "cm",
rownames(RColorBrewer::brewer.pal.info)),
reversePal = F
)
|
som |
'kohonen' object, a SOM created by the 'kohonen::som' function. |
pal |
character, the color palette. Default is "viridis". Can be "viridis", "grey", "rainbow", "heat", "terrain", "topo", "cm", or any palette name of the RColorBrewer package. |
reversePal |
logical, whether color palette should be reversed. Default is FALSE. |
Note: the resulting smooth distance plot is inexact for the hexagonal map layout.
1 2 3 4 5 6 7 8 9 10 11 12 13 | ## Build training data
dat <- iris[, c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width")]
### Scale training data
dat <- scale(dat)
## Train SOM
### RNG Seed (for reproducibility)
### Initialization (PCA grid)
init <- somInit(dat, 4, 4)
ok.som <- kohonen::som(dat, grid = kohonen::somgrid(4, 4, 'rectangular'),
rlen = 100, alpha = c(0.05, 0.01),
radius = c(6.08,-6.08), init = init,
dist.fcts = 'sumofsquares')
aweSOMsmoothdist(ok.som)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.