Once you have created a self-organising map using SOMTrain, you can query it using SOMRd. This UGen takes an input vector (i.e. multichannel input) and outputs the co-ordinate of the best-matching node in the SOM, i.e. the node which is closest to the input vector (using Euclidean distance). It can run at control- or audio-rate.
For some applications you might want to retrieve the best-matching template vector, i.e. the spatial location of the best-matching node, rather than just its index in the net. You can use SOMRd.coordsToBufIndex(coords, netsize) to find which Buffer frame contains that vector, and then use BufRd to pull the vector out. See examples...
A reference to the buffer containing the SOM.
An Array of the input signals for the net to map.
The size of the neural net along one dimension. Must match what you trained it with.
The dimensionality of the neural net. Choose from 1, 2, 3, or 4. Must match what you trained it with.
A simple on-or-off control. When off (gate<=0) the incoming data is ignored (output stays constant).
Here we'll assume you have a SOM trained as in the example from the SOMTrain helpfile, i.e. it's stored in variable ~som, with ~numnodes nodes, and a 1D net trained on 2D input data.