Initialize SOM weights with principal components
weights = initsom(inputs,dimensions,positions)
weights = initsom(inputs,dimensions,topologyFcn)
initsompc initializes the weights of an N-dimensional self-organizing map so that the initial weights are distributed across the space spanned by the most significant N principal components of the inputs. Distributing the weight significantly speeds up SOM learning, as the map starts out with a reasonable ordering of the input space.
weights = initsom(inputs,dimensions,positions) takes these arguments:
R-by-Q matrix of Q R-element input vectors
D-by-1 vector of positive integer SOM dimensions
D-by-S matrix of S D-dimension neuron positions
and returns the following:
S-by-R matrix of weights
weights = initsom(inputs,dimensions,topologyFcn) is an alternative specifying the name of a layer topology function instead of positions. topologyFcn is called with dimensions to obtain positions.
inputs = rand(2,100)+[2;3]*ones(1,100); dimensions = [3 4]; positions = gridtop(dimensions); weights = initsompc(inputs,dimensions,positions);