API Reference¶
The public API is small by design. Most workflows use the SOM
class, the SOMVisualizer, and (optionally) the
SOMConfig. The pages below document every module in full.
torchsom.core — the SOM class and its BaseSOM interface.
torchsom.utils — distances, neighborhoods, decay, clustering, metrics, search.
torchsom.visualization — SOMVisualizer and VisualizationConfig.
torchsom.configs — the Pydantic SOMConfig model.
Public objects at a glance¶
Object |
Purpose |
|---|---|
|
The Self-Organizing Map: |
|
Abstract base defining the SOM interface and shared attributes. |
|
Factory that renders every plot for the SOM’s topology. |
|
Styling options for figures (size, fonts, colormap, DPI, hex settings). |
|
Validated, serializable configuration for a |
|
Registry of distance metrics ( |
|
Registry of neighborhood kernels ( |
|
Registry of learning-rate and neighborhood-width decay schedules. |
Import conventions¶
The most common objects are re-exported at the top level:
from torchsom import SOM, SOMVisualizer
from torchsom.visualization import VisualizationConfig
from torchsom.configs import SOMConfig
The function registries let you list or extend the available options:
from torchsom import DISTANCE_FUNCTIONS, NEIGHBORHOOD_FUNCTIONS, DECAY_FUNCTIONS
print(list(DISTANCE_FUNCTIONS)) # available distance metrics
print(list(NEIGHBORHOOD_FUNCTIONS)) # available neighborhood kernels
See also
The Package Architecture page explains how these modules fit together, and the Training guide maps the constructor arguments to training behavior.