I've been using Matlab's toolbox for self-organizing maps, namely the newsom
and related family of functions. I'm applying SOM clustering to a large set of documents, and I have used the plotsomhits(net, features)
to visualize how many patterns/documents are assigned to each neuron. However, I cannot seem to find any functions in the toolbox that retrieve those hits in a data structure instead of just visualizing them.
Now I know that I can find the hits myself, picking the neuron that maximizes the negative distance metric for each pattern, in a simple for
loop:
nweights = net.IW{1}; % retrieve weights
mx = -Inf; winner = 1;
for i = 1:length(nweights)
distance = negdist(nweights(i, :), pattern);
if distance > mx % update index of winner
mx = distance;
winner = i;
end
end
However it seems very odd to me that there is no available function in the SOM toolbox, given that a function for visualizing such results exists.
Does anyone know about this? Also, is there a faster method to find the neuron each pattern is 'assigned' to than the one I am describing above?