Learn R Programming

RSNNS (version 0.3-1)

som: Create and train a self-organizing map (som).

Description

Create and train a self-organizing map (som).

Usage

som(x, ...)
## S3 method for class 'default':
som(x, mapX=16, mapY=16, maxit=100, initFuncParams=c(1, -1),
    learnFuncParams=c(0.5, mapX/2, 0.8, 0.8, mapX),
    updateFuncParams=c(0, 0, 1), shufflePatterns=TRUE,
    calculateMap=TRUE, calculateActMaps=FALSE,
    calculateSpanningTree=FALSE, saveWinnersPerPattern=FALSE, targets,
    ...)

Arguments

x
a matrix with training inputs for the network
mapX
the x dimension of the som
mapY
the y dimension of the som
maxit
maximum of iterations to learn
initFuncParams
the parameters for the initialization function
learnFuncParams
the parameters for the learning function
updateFuncParams
the parameters for the update function
shufflePatterns
should the patterns be shuffled?
calculateMap
should the som be calculated?
calculateActMaps
should the activation maps be calculated?
calculateSpanningTree
should the SNNS kernel algorithm for generating a spanning tree be applied?
saveWinnersPerPattern
should a list with the winners for every pattern be saved?
targets
optional target classes of the patterns
...
additional function parameters (currently not used)

Value

  • som.default: an rsnns object. Depending on which calculation flags are switched on, the som generates some special members:
  • mapthe som. For each unit, the amount of patterns where this unit won is given.
  • componentMapsa map for every input component, showing where in the map this component leads to high activation.
  • actMapsa list containing for each pattern its activation map, i.e. all unit activations. The actMaps are an intermediary result, from which all other results can be computed. This list can be very long, so normally it won't be saved.
  • winnersPerPatterna vector where for each pattern the number of the winning unit is given. Also, an intermediary result that normally won't be saved.
  • labeledUnitsa matrix which -- if the targets parameter is given -- contains for each unit (rows) and each class present in the targets (columns), the amount of patterns of the class where the unit has won. From the labeledUnits, the labeledMap can be computed, e.g. by voting of the class labels for the final label of the unit.
  • labeledMapa labeled som that is computed from labeledUnits using decodeClassLabels.
  • spanningTreethe result of the original SNNS function to calculate the map. For each unit, the last pattern where this unit won is present. As the other results are more informative, the spanning tree is only interesting, if the other functions are too slow or if the original SNNS implementation is needed.

Details

som: This function creates and trains a self-organizing map. As the computation might be slow if many patterns are involved, much of its output is made switchable (see comments on return values).

Examples

Run this code
demo(som_iris)
demo(som_cubeSnnsR)

Run the code above in your browser using DataLab