Rsomoclu.kohonen: convert Somoclu train result to kohonen class for plotting

Description Usage Arguments Value See Also Examples

View source: R/Rsomoclu.R

Description

A function call to convert Somoclu train result to kohonen class for plotting.

Usage

1
Rsomoclu.kohonen(input_data, result, n.hood = NULL, toroidal = FALSE)

Arguments

input_data

input data, matrix format

result

The result returned by Rsomoclu.train

n.hood

Same as in koohonen, the shape of the neighbourhood, either "circular" or "square". The latter is the default for rectangular maps, the former for hexagonal maps.

toroidal

if TRUE, the edges of the map are joined. Note that in a hexagonal toroidal map, the number of rows must be even.

Value

An object of class kohonen for plotting.

See Also

http://www.r-bloggers.com/self-organising-maps-for-customer-segmentation-using-r/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library('Rsomoclu')
library('kohonen')
data("rgbs", package = "Rsomoclu")
input_data <- rgbs
input_data <- data.matrix(input_data)
nSomX <- 20
nSomY <- 20
nEpoch <- 10
radius0 <- 0
radiusN <- 0
radiusCooling <- "linear"
scale0 <- 0
scaleN <- 0.01
scaleCooling <- "linear"
kernelType <- 0
mapType <- "planar"
gridType <- "rectangular"
compactSupport <- FALSE
codebook <- NULL
neighborhood <- "gaussian"
stdCoeff <- 0.5
res <- Rsomoclu.train(input_data, nEpoch, nSomX, nSomY,
                      radius0, radiusN,
                      radiusCooling, scale0, scaleN,
                      scaleCooling,
                      kernelType, mapType, gridType, compactSupport, 
                      neighborhood, stdCoeff, codebook)
## Convert to kohonen object for plotting
sommap = Rsomoclu.kohonen(input_data, res)
## Show 'codebook'
plot(sommap, type="codes", main = "Codes")
## Show 'component planes'
plot(sommap, type = "property", property = sommap$codes[[1]][,1],
     main = colnames(sommap$codes)[1])
## Show 'U-Matrix'
plot(sommap, type="dist.neighbours")

Rsomoclu documentation built on June 6, 2017, 5:04 p.m.

Search within the Rsomoclu package
Search all R packages, documentation and source code