Back to Portfolio
Open SourceMachine Learning

SOM Plus Clustering

A Rust self-organizing map library: 11 initialization strategies, parameter-free density and auto-k routing extensions, and Rayon/Metal/CUDA-accelerated training with built-in cluster quality metrics.

Feature Breakdown

What is it?

Standard SOM implementations leave too much to chance. Random initialization can produce wildly different maps across runs, and most libraries provide no way to evaluate whether the resulting clusters are actually meaningful.

SOM Plus is a Rust library covering 11 initialization strategies (from plain random to KDE-peak and LSUV) plus two parameter-free clustering extensions — DenSOM (density-based, no fixed k) and AutoSOM (auto-k routing via BIC/gap statistic) — with Rayon CPU parallelism and a Metal GPU backend for training at scale. It grew out of the GDP trajectory clustering project and the functional group analysis work, where reliable clustering was critical to interpretation, and now also powers the SOM-TSK candidate-seeding research.

What it does

  • 11 Initialization Strategies — Random, KMeans, KMeans++, KDE-KMeans, SOM++, He, LeCun, NaiveSharding, LSUV, KDE-peak, and Zero, each unit-tested.
  • DenSOM & AutoSOM — Parameter-free density-based clustering and automatic k-selection layered on top of the core SOM.
  • GPU-Accelerated Training — Rayon CPU parallelism plus a Metal backend (CI-tested) and a CUDA backend (feature-flagged, not yet CI-verified on real hardware).
  • Full Evaluation Suite — Silhouette, Davies-Bouldin, Calinski-Harabasz, Dunn, classification accuracy, and B-cubed precision/recall, all built in.
  • Supervised Classification Mode — Propagates labels through a trained SOM grid for supervised use, not just unsupervised clustering.
  • Research-ready — Bincode/JSON persistence and a clean Rust API built for reproducible scientific use.

Live SOM demo

Run a self-organizing map right here in the browser — no install, no build. Watch the neuron lattice fold onto a point cloud and the topology emerge as points take their best-matching neuron’s colour. Tune the grid, learning rate, neighbourhood, and epochs, or swap datasets.

Epoch 0 / 40

Pure in-browser SOM — no server, no build step.

Built with

RustRayonMetalCUDA

See the code

Full source, docs, and usage examples on GitHub.