setWeights: Set a matrix as the prototypes' matrix

Description Usage Arguments Value Author(s) See Also Examples

Description

Set a matrix as the prototypes' matrix of a som object.

Usage

1

Arguments

x

a som object

new

a numeric matrix that have the same dimension that the prototypes' matrix of the som object

Value

a som object

Author(s)

David Gohel

See Also

som learn getWeights

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)
plot( lcrabs.som , "effectif" )

x <- getWeights ( lcrabs.som )
# change values of the first prototype
x[1,]=0
lcrabs.som <- setWeights ( lcrabs.som , x )
plot( lcrabs.som , "effectif" )

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