ML Train SOM

Unsupervised learning module based on a Self-Organizing Map (Kohonen network). Trains a 2D grid of neurons to reflect the topology of high-dimensional input data, then outputs the Best Matching Unit (BMU) position and a color visualization of the learned map.

A Self-Organizing Map (SOM) is an unsupervised neural network that projects high-dimensional data onto a low-dimensional (here 2D) grid while preserving topological relationships. Nearby neurons in the grid respond to similar input patterns. Over time, the map develops regions that cluster similar data points together, making it useful for dimensionality reduction, anomaly detection, and visualizing data structure.

Settings

Inputs

in

Array of float values representing one data sample. The length of the array determines the input dimension and is detected automatically on the first frame. Connect any sensor, feature vector, or multi-channel data source here.

learn

Switch. When ON, the map weights are updated at each process cycle using the current learning rate and neighborhood radius. When OFF, the module still finds and outputs the BMU but does not modify the map — useful for inference-only operation after training.

reset

Trigger. Clears all learned weights and hit counters, and resets the iteration counter to zero. The map will re-initialize from random weights on the next incoming frame.

Settings

grid width

Number of neurons along the horizontal axis of the map. Range 2 – 64, default 16. Changing this value triggers an automatic map reset.

grid height

Number of neurons along the vertical axis of the map. Range 2 – 64, default 16. Changing this value triggers an automatic map reset.

learn rate

Initial learning rate α₀. Controls how strongly the winning neuron and its neighbors are pulled toward each input sample. Range 0.001 – 1.0, default 0.1. The effective rate decays over time by the decay factor.

radius

Initial neighborhood radius σ₀. Defines how far (in grid cells) the influence of a BMU update spreads using a Gaussian kernel. Range 0.5 – 64, default 8. Decays over time by the decay factor, eventually focusing updates on the BMU alone.

decay

Multiplicative decay factor applied to both the learning rate and the neighborhood radius after each training step. Range 0.9 – 0.99999, default 0.999. Values close to 1 produce slow, gradual decay (long training runs); lower values converge faster but may under-train the map borders.

Outputs

bmu xy

Float array of length 2. Contains the [x, y] grid coordinates of the Best Matching Unit, normalized to [0, 1]. Connect to a 2D display, XY pad, or trajectory module to track input position on the map over time.

bmu id

Linear index of the BMU neuron: id = bmu_y × grid_width + bmu_x. Useful for direct lookup, routing, or discrete classification.

bmu distance

Euclidean distance in weight space between the input vector and the winning neuron's weight vector. Low values indicate a good match; high values indicate that the input is far from any learned cluster (novelty / anomaly indicator).

color map

Color array of length grid_width × grid_height. Each element is a color encoding determined by the selected viz mode. Connect to an Array Display module configured for 2D grid rendering (set its width to match grid width) for a live visualization.

iterations

Total number of training steps performed since the last reset. Useful for monitoring convergence or for triggering actions at specific training milestones.

Visualization

viz mode

Selects the rendering mode for the color map output.

Mode Description
u-matrix Each neuron is colored by the average Euclidean distance to its 4 direct neighbors (up, down, left, right). High values (warm colors) mark cluster boundaries; low values (cool colors) mark the interior of clusters. This is the standard SOM visualization.
hit map Each neuron is colored by how many times it was the BMU since the last reset. Bright areas show the most frequently activated neurons, revealing the density distribution of the training data.
bmu highlight Displays a dimmed U-Matrix as background and highlights the current BMU in white. Useful for real-time monitoring of which region of the map is currently activated.

Workflow

Training phase

  1. Connect your data source to in and set learn to ON.
  2. Let the map run until iterations stabilizes and the bmu distance settles to a low value.
  3. Monitor the color map output on an Array Display — distinct colored regions indicate that the map has learned clusters.

Inference phase

  1. Set learn to OFF to freeze the map.
  2. The module continues to output bmu xy, bmu id, and bmu distance for new incoming data without modifying the weights.
  3. Save your patch: the trained weights are persisted automatically in the patch file and restored on reload.

The map re-initializes automatically if the length of the in array changes (different input dimension). Always connect a data source with a consistent array length before training.

Learning rate and radius both decay continuously during training. After many iterations they approach zero, effectively halting learning even if learn is ON. Use reset to restart training with fresh weights and full initial rates.

Common Settings

info

show manual

Button. Opens the manual page of the selected object (or of its parent module for a control) in the web browser. If no page exists for this object, an error is traced in the trace panel.

For more details about information/help creation, see create-help-file.

description

Free multi-line text attached to the module, saved with the patch. It is only meant as an internal note for the patch designer: it is not displayed in the interface.

ID's

visible only in god mode, see setup-panel-tab-expert.

unique ID

Read-only, not saved. Current private numeric ID of the object, used internally to identify it (for example as the target of a bind ID).

preset ID

Read-only, not saved. Private ID used to store and recall the values of this control in presets.

recreate ID

Button. Generates a new unique ID, original ID and preset ID for the object. Use it if you experience difficulties in Polyphonic mode or if two objects share the same ID. Preset values and binds referring to the old IDs are lost.

Object Remote Address

absolute

Read-only, not saved. Absolute address of the object in the Usine objects tree, built from the workspace root. This is the address to use to reach the object from scripts, the objects panel or remote messages. Only shown for objects that are registered in the objects list. See objects-address.

local

Read-only, not saved. Address of the object relative to the current patch, valid inside that patch only. See objects-address.

user addr

Free user-defined address for the object (empty by default). When set, the object is also registered in the objects tree under this name, so it can be reached independently of its position in the workspace (the value is also reported in the mouse-over and mouse-down chunks). Changing it rebuilds the objects list. Only available on objects that support a user address. See objects-address.

See also

version 7.0.250121

Edit All Pages