Skip to content

v1.2.0

Choose a tag to compare

@SandroMartens SandroMartens released this 30 May 08:16
· 145 commits to main since this release

Implemented lots of general fixes, enhancements and performance improvements. Both SomVQ and SomClassifier are now (mostly) stable and fully sklearn API conform.

New Features

  • Cosine similarity metric (metric="cosine") — normalizes weight vectors during training and uses an efficient BLAS matrix multiplication path for BMU search
  • tau_2 parameter for GHSOM — second stopping criterion for vertical growth
  • PCA-based RGB color mapping in plot() and new layout parameter
  • Edges carry their length as an attribute (weight_distance)

Improvements

  • Numba-JIT winner search for n_bmu=1 replaces NearestNeighbors — significantly faster on the hot training path
  • Vectorized weight update replaces the scalar loop over neurons
  • Topographic function corrected — now uses Floyd-Warshall graph distance instead of Euclidean/Chebyshev distance on weight vectors, matching the definition from Villmann et al. (1997)
  • Topographic error corrected — Manhattan instead of Euclidean distance for grid positions
  • U-matrix calculation optimized and plot method fixed for unsupervised models
  • Node statistics vectorized
  • Neuron insertion simplified to a single unified directed insertion rule

API Fixes

  • convergence_treshold → convergence_threshold (typo fixed), with parameter validation
  • BaseSom is now an abstract base class (ABC) — predict() and _label_prototypes() are abstract methods
  • SomClassifier.fit() has an explicit signature with a mandatory y parameter and validation
  • Classification targets are validated in BaseSom.fit()
  • Cluster label encoding in SomVQ.predict() now returns contiguous integer labels
  • Fixed division by zero in _update_weights() and dead neuron probability handling
  • Dead neurons are no longer deleted from the graph (previously broke sklearn API consistency)
  • Minimum dependency version bounds lowered to tested minima

Tests

  • Comprehensive test suite for SomClassifier/SomVQ equivalence
  • Regression tests for classifier and digits training
  • Tests for entropy-based growth criterion
  • pytest markers (slow) introduced

Full Changelog: v1.1.1...v1.2.0