aweSOMsmoothdist: Smooth Distance Plot

Description Usage Arguments Details Examples

View source: R/plots.R

Description

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.

Usage

1
2
3
4
5
6
aweSOMsmoothdist(
  som,
  pal = c("viridis", "grey", "rainbow", "heat", "terrain", "topo", "cm",
    rownames(RColorBrewer::brewer.pal.info)),
  reversePal = F
)

Arguments

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.

Details

Note: the resulting smooth distance plot is inexact for the hexagonal map layout.

Examples

 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)

jansodoge/awesom_dev_version documentation built on Jan. 26, 2021, 8:53 a.m.