update.som: Update a som object

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

Description

Update a som object, compute statitics and can also project a new dataset

Usage

1
update.som(object, newdata)

Arguments

object

a som object

newdata

a data frame in which to interpret the variables of the som object.

Details

groups, size, withinss are re-computed.

Value

a som object.

Note

This function is useful if you want to project a new dataset with the som object or if you have modified by the hand the weights matrix.

Author(s)

David Gohel

See Also

som learn learnBatch plot.som summary.som predict.som biplot.som getWeights setWeights

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
library(MASS)
lcrabs <- log(crabs[, 4:8])

lcrabs.som <- som ( formula = ~ . , data = lcrabs
	, neighborhood = "uniform"
	, grid = grid ( xdim = 10 , ydim = 10 , type = "hexagonal" ) 
	, weights.min = min (lcrabs), weights.max = max (lcrabs)
	)
lcrabs.som <- learn( lcrabs.som , number.iter = 500 , max.alpha = 0.5, min.alpha = .001, max.rayon = 3 , step.eval.si = 50)

# see the counts' map with learning data
plot( lcrabs.som , "effectif", cex.label = 0)

# see the counts' map with new data
lcrabs.som <- update( lcrabs.som , newdata = lcrabs[1:20,] )
plot( lcrabs.som , "effectif", cex.label = 0)

harrysouthworth/kohonen documentation built on May 17, 2019, 3:03 p.m.