som.tune: Parameter tuning for Self-Organising Maps

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

This function tunes some parameters of a Self-Organising Map by optimising a specified error measure. The prior structure is not optimised by this function.

Usage

1
2
3
4
som.tune(data, somgrid, control = som.tunecontrol(somgrid),
         weights, verbose = FALSE, internalVerbose = FALSE)
## S3 method for class 'somtune'
print(x,...)

Arguments

data

the data to which the SOM will be fitted. This can be, e.g., a matrix or data frame of observations (which should be scaled), or a distance matrix

somgrid

an object of class 'somgrid'

control

a control object which specifies the parameter to optimize

weights

optional weights for the data points

verbose

switch for tracing the tuning process

internalVerbose

switch for tracing each call to batchsom

x

an object of class "somtune"

...

not used

Details

The optimisation is done via a simple grid search that fit a Self-Organising Map for each possible combination of the parameters to tune. The prior structure itself is excluded from the optimisation as most quantisation related error measures decrease with the size of the grid.

Value

An object of class "somtune", a list with components

best.som

the best SOM according to the chosen error criterion

errors

the error for each configuration

quantisation

the quantisation error for each configuration

isquant

TRUE if the best SOM was chosen according to the quantisation error

control

the control object used by this call

dimensions

a list of strings with the names of the parameters that were varied by the function

init,assignement,radii,annealing,kernel

5 vectors containing the parameters used by each tested configuration

best.index

the index of the configuration used by the best SOM

Note

this function is modelled after David Mayer's tune function.

Author(s)

Fabrice Rossi

See Also

som.tunecontrol and plot.somtune

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
data(iris)
# scaling
data <- scale(iris[1:4])

# a medium hexagonal grid
sg <- somgrid(xdim=15,ydim=15,topo="hex")

# choose a good SOM via Kaski and Lagus' error measure
tune.results <- som.tune(data,sg,
                         som.tunecontrol(sg,criterion=error.kaskilagus))

# print the results
print(tune.results)

# umatrix of the best SOM
umatrix(tune.results$best.som)

# give more weight to the first specie (i.e. setosa)
tune.results <-  som.tune(data,sg,
                          som.tunecontrol(sg,criterion=error.kaskilagus),
                          weights=c(rep(3,50),rep(1,100)))

# print the results
print(tune.results)

# umatrix of the best SOM
umatrix(tune.results$best.som)

yasomi documentation built on May 2, 2019, 5:59 p.m.