% % Written by: % -- % John L. Weatherwax 2005-08-14 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- addpath( '../../Code/eda_data' ); addpath( '../../Code/eda_toolbox' ); close all; drawnow; clc; clear; randn('seed',0); rand('seed',0); % Modified from Example 3.6 Self-Organizing Map % % Use the oronsay data set load oronsay % convert labels to cell array of strings. for i = 1:length(beachdune) mid{i} = int2str(midden(i)); % Use next one in exercises. bd{i} = int2str(beachdune(i)); end % Normalize each variable to have unit variance and mean 0. D = som_normalize(oronsay,'var'); sD = som_data_struct(D); sD = som_set(sD,'labels',mid'); % Make the SOM sM = som_make(sD); sM = som_autolabel(sM,sD,'vote'); som_show(sM,'umat','all'); som_show_add('label',sM,'subplot',1); %-- % try the som_show command as is ... plots all components on one graph % som_show(sM); for i=1:12, som_show(sM,'comp',i); % plots the individual component maps title( [ 'compnent ',num2str(i) ] ); fprintf('press any key to see the next component\n'); pause; close all; end