how to set the dimensions for a SOM map?

4 views (last 30 days)
maxina dialin
maxina dialin on 6 Oct 2012
While using SOM for clustering an image using the function net=selforgmap([d1,d2]) How to set the values for d1 and d2?

Answers (1)

Greg Heath
Greg Heath on 7 Oct 2012
Edited: Greg Heath on 7 Oct 2012
1. Plot the projection of the data on the dominant PCA plane to get a "good feel" for the data:
a. lookfor 'principal component'
b. Test on the iris_dataset example
2. Create and train a SOM net using defaults:
net = selforgmap;
3. Look at the 6 default training plots. PLOTSOMND, PLOTSOMHITS, and PLOTSOMPOS are probably the most useful for estimating a better choice for [d1,d2].
Hope this helps.
Thank you for formally accepting my answer.
  1 Comment
Greg Heath
Greg Heath on 7 Oct 2012
close all, clear all, clc, plt=0;
% x = iris_dataset;
x = simplecluster_dataset;
whos
[ I N ] = size(x) % [ 2 1000 ]
' 1. PROJECT THE DATA ON THE DOMINANT PRINCIPAL COMPONENT PLANE '
plt = plt+1; figure(plt)
plot(x(1,:),x(2,:),'o')
'2. CREATE AND TRAIN A MAP USING DEFAULTS'
net = selforgmap; %default is 8X8
net.IW{:} % Empty matrix: 0-by-64
net.LW{:} % []
net.b{:} % []
net = train(net,x);
net.IW % [64x2 double]
net.LW % { [] }
net.b % { [] }
'3. VIEW THE 6 DEFAULT SOM PLOTS. THE LAST 3 ARE THE MOST USEFUL FOR EVALUATING PERFORMANCE: '
plt = plt+1; figure(plt)
plotsomtop(net) % SOM Topology
plt = plt+1; figure(plt)
plotsomnc(net) % SOM Neighbor Connections
plt = plt+1; figure(plt)
plotsomplanes(net) % SOM Input Planes
plt = plt+1; figure(plt)
plotsomnd(net,x) %(The Neighbor Weight Distances)
plt = plt+1; figure(plt)
plotsomhits(net,x) %(SOM Sample Hits)
plt = plt+1; figure(plt)
plotsompos(net,x) %(SOM Weight Positions))
'4. ASSIGN EACH INPUT TO ONE OF THE d1*d2 SOM CENTERS'
y = net(x); % 64 X 1000
classes = vec2ind(y); % 1 X 1000
example = classes(1:20)

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!