In MATLAB, clustering data using kmeans can be achieved as shown below:
L = kmeans(X,k,Name,Value) where L is cluster indices which is for each data point.
It implies that is if I have 307 data points I'm to have a 307 x 1 array(L) which is the index for each data point.
However, while using SOM for clustering I discovered to get the index you use the code snippet below:
net = selforgmap([dimension1 dimension2]);
% Train the Network
[net,tr] = train(net,X);
%get indices
L = vec2ind(net(X))';
for a Network with 5 x 5 dimension:
it returns L which is an array with the dimesion 25 x 1 instead of 307 x 1 for a Network with 10 x 10 dimension:
it returns L which is an array with the dimesion 100 x 1 instead of 307 x 1
What am I doing wrong???
or to simply put, how do I compute the class vectors of each of the training inputs ?