torchsom


Nametorchsom JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
Summarytorchsom: The Reference PyTorch Library for Self-Organizing Maps
upload_time2025-09-01 14:20:20
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords self-organizing-maps som pytorch machine-learning unsupervised-learning dimensionality-reduction clustering data-visualization just-in-time-learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `torchsom`: The Reference PyTorch Library for Self-Organizing Maps

<div align="center">

<!-- Global Package information -->
[![PyPI version](https://img.shields.io/pypi/v/torchsom.svg?color=blue)](https://pypi.org/project/torchsom/)
[![Python versions](https://img.shields.io/pypi/pyversions/torchsom.svg?color=blue)](https://pypi.org/project/torchsom/)
[![PyTorch versions](https://img.shields.io/badge/PyTorch-2.7-EE4C2C.svg)](https://pytorch.org/)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/license/apache-2-0)

<!-- Sonar Qube badges -->
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=coverage)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)

<!-- [![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-light.svg)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM) -->

<!-- GitHub Workflows -->
[![Tests](https://github.com/michelin/TorchSOM/workflows/Tests/badge.svg)](https://github.com/michelin/TorchSOM/actions/workflows/test.yml)
[![Code Quality](https://github.com/michelin/TorchSOM/workflows/Code%20Quality/badge.svg)](https://github.com/michelin/TorchSOM/actions/workflows/code-quality.yml)
[![Downloads](https://static.pepy.tech/badge/torchsom)](https://pepy.tech/project/torchsom)
[![GitHub stars](https://img.shields.io/github/stars/michelin/TorchSOM.svg?style=social&label=Star)](https://github.com/michelin/TorchSOM)
<!-- [![Security](https://github.com/michelin/TorchSOM/workflows/Security%20Scanning/badge.svg)](https://github.com/michelin/TorchSOM/actions/workflows/security.yml) -->

<!-- Code Style and Tools -->
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/imports-isort-6c757d.svg?color=blue)](https://pycqa.github.io/isort/)
[![Ruff](https://img.shields.io/badge/linter-ruff-6c757d.svg?color=blue)](https://github.com/astral-sh/ruff)

<p align="center">
    <img src="assets/logo.png" alt="TorchSOM_logo" width="400"/>
</p>

**A modern, comprehensive and GPU-accelerated PyTorch implementation of Self-Organizing Maps for scalable ML workflows**

[πŸ“š Documentation](https://opensource.michelin.io/TorchSOM/)
| [πŸš€ Quick Start](#-quick-start)
| [πŸ“Š Examples](notebooks/)
| [🀝 Contributing](CONTRIBUTING.md)
<!-- | [πŸ“„ Paper (PDF)](assets/torchsom_jmlr.pdf) -->

**⭐ If you find [`torchsom`](https://github.com/michelin/TorchSOM) valuable, please consider starring this repository ⭐**

</div>

---

## 🎯 Overview

Self-Organizing Maps (SOMs) remain **highly relevant in modern machine learning** (ML) due to their **interpretability**, **topology preservation**, and **computational efficiency**. They excel and are widely used in domains such as energy systems, biology, internet of things (IoT), environmental science, and industrial applications.

Despite their utility, the SOM ecosystem is fragmented. Existing implementations are often **outdated**, **unmaintained**, and **lack GPU acceleration or modern deep learning** (DL) **framework integration**, limiting adoption and scalability.

**`torchsom`** addresses these gaps as a **reference PyTorch library** for SOMs. It provides:

- **GPU-accelerated training**
- **Advanced clustering capabilities**
- A **scikit-learn-style API** for ease of use
- **Rich visualization tools**
- **Robust software engineering practices**

`torchsom` enables researchers and practitioners to integrate SOMs seamlessly into workflows, from exploratory data analysis to advanced model architectures.

This library accompanies the paper: [`torchsom`: The Reference PyTorch Library for Self-Organizing Maps](assets/torchsom_jmlr.pdf). If you use `torchsom` in academic or industrial work, please cite both the paper and the software (see [`CITATION`](CITATION.cff)).

> **Note**: See the comparison table below to understand how `torchsom` differs from other SOM libraries, and explore our [Visualization Gallery](#-visualization-gallery) for example outputs.

## ⚑ Why `torchsom`?

Unlike legacy implementations, `torchsom` is engineered from the ground up for modern ML workflows:

|  | [torchsom](https://github.com/michelin/TorchSOM) | [MiniSom](https://github.com/JustGlowing/minisom) | [SimpSOM](https://github.com/fcomitani/simpsom) | [SOMPY](https://github.com/sevamoo/SOMPY) | [somoclu](https://github.com/peterwittek/somoclu) | [som-pbc](https://github.com/alexarnimueller/som) |
|---|---|---|---|---|---|---|
| **Architecture Section** |  |  |  |  |  |  |
| Framework | PyTorch | NumPy | NumPy | NumPy | C++/CUDA | NumPy |
| GPU Acceleration |  βœ… CUDA | ❌ | βœ… CuPy/CUML | ❌ | βœ… CUDA | ❌ |
| API Design | scikit-learn | Custom | Custom | MATLAB | Custom | custom |
| **Development Quality Section** |  |  |  |  |  |  |
| Maintenance | βœ… Active | βœ… Active | ⚠️ Minimal | ⚠️ Minimal | ⚠️ Minimal | ❌ |
| Documentation | βœ… Rich | ❌ | ⚠️ Basic | ❌ | ⚠️ Basic | ⚠️ Basic |
| Test Coverage | βœ… ~86% | ❌ | 🟠 ~53% | ❌ | ⚠️ Minimal | ❌ |
| PyPI Distribution | βœ… | βœ… | βœ… | ❌ | βœ… | ❌ |
| **Functionality Section** |  |  |  |  |  |  |
| Visualization | βœ… Advanced | ❌ | 🟠 Moderate | 🟠 Moderate | ⚠️ Basic | ⚠️ Basic |
| Clustering | βœ… Advanced | ❌ | ❌ | ❌ | ❌ | ❌ |
| JITL support | βœ… Built-in | ❌ | ❌ | ❌ | ❌ | ❌ |
| SOM Variants | 🚧 In development | ❌ | 🟠 PBC | ❌ | 🟠 PBC | 🟠 PBC |
| Extensibility | βœ… High | 🟠 Moderate | ⚠️ Low | ⚠️ Low | ⚠️ Low | ⚠️ Low |

> **Note**: `torchsom` supports **Just-In-Time Learning (JITL)**.
> Given an online query, JITL collects relevant datapoints to form a local buffer (selected first by topology, then by distance). A lightweight local model is then trained on this buffer, enabling efficient supervised learning (regression or classification).

---

## πŸ“‘ Table of Contents

- [Quick Start](#-quick-start)
- [Tutorials](#-tutorials)
- [Installation](#-installation)
- [Documentation](#-documentation)
- [Citation](#-citation)
- [Contributing](#-contributing)
- [Acknowledgments](#-acknowledgments)
- [License](#-license)
- [Related Work and References](#-related-work-and-references)
<!-- - [Reproducibility](#-reproducibility) -->
<!-- - [Performance Benchmarks](#-performance-benchmarks) -->

---

## πŸš€ Quick Start

Get started with `torchsom` in just a few lines of code:

```python
import torch
from torchsom.core import SOM
from torchsom.visualization import SOMVisualizer

# Create a 10x10 map for 3D input
som = SOM(x=10, y=10, num_features=3, epochs=50)

# Train SOM for 50 epochs on 1000 samples
X = torch.randn(1000, 3)
som.initialize_weights(data=X, mode="pca")
QE, TE = som.fit(data=X)

# Visualize results
visualizer = SOMVisualizer(som=som, config=None)
visualizer.plot_training_errors(quantization_errors=QE, topographic_errors=TE, save_path=None)
visualizer.plot_hit_map(data=X, batch_size=256, save_path=None)
visualizer.plot_distance_map(
  save_path=None,
  distance_metric=som.distance_fn_name,
  neighborhood_order=som.neighborhood_order,
  scaling="sum"
)
```

## πŸ““ Tutorials

Explore our comprehensive collection of Jupyter notebooks:

- πŸ“Š [`iris.ipynb`](notebooks/iris.ipynb): Multiclass classification
- 🍷 [`wine.ipynb`](notebooks/wine.ipynb): Multiclass classification
- 🏠 [`boston_housing.ipynb`](notebooks/boston_housing.ipynb): Regression
- ⚑ [`energy_efficiency.ipynb`](notebooks/energy_efficiency.ipynb): Multi-output regression
- 🎯 [`clustering.ipynb`](notebooks/clustering.ipynb): SOM-based clustering analysis

### 🎨 Visualization Gallery

<p align="center">
  <table>
    <tr>
      <td align="center">
        <b>πŸ—ΊοΈ D-Matrix Visualization</b><br>
        <p>Michelin production line (regression)</p>
        <img src="assets/michelin_dmatrix.png" alt="U-Matrix" width="220"/>
      </td>
      <td align="center">
        <b>πŸ“ Hit Map Visualization</b><br>
        <p>Michelin production line (regression)</p>
        <img src="assets/michelin_hitmap.png" alt="Hit Map" width="220"/>
      </td>
      <td align="center">
        <b>πŸ“Š Mean Map Visualization</b><br>
        <p>Michelin production line (regression)</p>
        <img src="assets/michelin_meanmap.png" alt="Mean Map" width="220"/>
      </td>
    </tr>
    <tr>
      <td align="center" colspan="2">
        <b>πŸ—ΊοΈ Component Planes Visualization</b><br>
        <p>Another Michelin line (regression)</p>
        <table>
          <tr>
            <td align="center">
              <img src="assets/michelin_cp12.png" alt="Component Plane 1" width="220"/>
            </td>
            <td align="center">
              <img src="assets/michelin_cp21.png" alt="Component Plane 2" width="220"/>
            </td>
          </tr>
        </table>
      </td>
      <td align="center">
        <b>🏷️ Classification Map</b><br>
        <p>Wine dataset (multi-classification)</p>
        <img src="assets/wine_classificationmap.png" alt="Classification Map" width="220"/>
      </td>
    </tr>
    <tr>
      <td align="center">
        <b>πŸ“Š Cluster Metrics</b><br>
        <p>Clustering analysis</p>
        <img src="assets/cluster_metrics.png" alt="Cluster Metrics" width="220"/>
      </td>
      <td align="center">
        <b>πŸ“ˆ K-Means Elbow</b><br>
        <p>Optimal cluster selection</p>
        <img src="assets/kmeans_elbow.png" alt="K-Means Elbow" width="220"/>
      </td>
      <td align="center">
        <b>🎯 HDBSCAN Cluster Map</b><br>
        <p>Cluster visualization</p>
        <img src="assets/hdbscan_cluster_map.png" alt="HDBSCAN Cluster Map" width="220"/>
      </td>
    </tr>
  </table>
</p>

---

## πŸ’Ύ Installation

### πŸ“¦ PyPI

```bash
pip install torchsom
```

### πŸ”§ Development Version

```bash
git clone https://github.com/michelin/TorchSOM.git
cd TorchSOM
python3.9 -m venv .torchsom_env
source .torchsom_env/bin/activate
pip install -e ".[all]"
```

---

## πŸ“š Documentation

Comprehensive documentation is available at [opensource.michelin.io/TorchSOM](https://opensource.michelin.io/TorchSOM/)

---

## πŸ“ Citation

If you use `torchsom` in your academic, research or industrial work, please cite both the paper and software:

```bibtex
@inproceedings{Berthier2025TorchSOM,
    title={torchsom: The Reference PyTorch Library for Self-Organizing Maps},
    author={Berthier, Louis},
    booktitle={Conference Name},
    year={2025}
}

@software{Berthier_TorchSOM_The_Reference_2025,
    author={Berthier, Louis},
    title={torchsom: The Reference PyTorch Library for Self-Organizing Maps},
    url={https://github.com/michelin/TorchSOM},
    version={1.0.0},
    year={2025}
}
```

For more details, please refer to the [CITATION](CITATION.cff) file.

---

## 🀝 Contributing

We welcome contributions from the community! See our [Contributing Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md) for details.

- **GitHub Issues**: [Report bugs or request features](https://github.com/michelin/TorchSOM/issues)
<!-- - **GitHub Discussions**: [Ask questions and share ideas](https://github.com/michelin/TorchSOM/discussions) -->

---

## πŸ™ Acknowledgments

- [Centre de MathΓ©matiques AppliquΓ©es (CMAP)](https://cmap.ip-paris.fr/) at Γ‰cole Polytechnique
- [Manufacture FranΓ§aise des Pneumatiques Michelin](https://www.michelin.com/) for collaboration
- [Giuseppe Vettigli](https://github.com/JustGlowing) for [MiniSom](https://github.com/JustGlowing/minisom) inspiration
- The [PyTorch](https://pytorch.org/) team for the amazing framework
- Logo created using [DALL-E](https://openai.com/index/dall-e-3/)

---

## πŸ“„ License

`torchsom` is licensed under the [Apache License 2.0](LICENSE). See the [LICENSE](LICENSE) file for details.

---

## πŸ“š Related Work and References

### πŸ“– Foundational Literature Papers

- Kohonen, T. (2001). [Self-Organizing Maps](https://link.springer.com/book/10.1007/978-3-642-56927-2). Springer.

### πŸ”— Related Softwares

- [MiniSom](https://github.com/JustGlowing/minisom): Minimalistic Python SOM
- [SimpSOM](https://github.com/fcomitani/simpsom):Simple Self-Organizing Maps
- [SOMPY](https://github.com/sevamoo/SOMPY): Python SOM library
- [somoclu](https://github.com/peterwittek/somoclu): Massively Parallel Self-Organizing Maps
- [som-pbc](https://github.com/alexarnimueller/som): A simple self-organizing map implementation in Python with periodic boundary conditions
- [SOM Toolbox](http://www.cis.hut.fi/projects/somtoolbox/): MATLAB implementation

---

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "torchsom",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Louis Berthier <louis-desire-romeo.berthier@michelin.com>",
    "keywords": "Self-Organizing-Maps, SOM, PyTorch, Machine-Learning, Unsupervised-Learning, Dimensionality-Reduction, Clustering, Data-Visualization, Just-In-Time-Learning",
    "author": null,
    "author_email": "Louis Berthier <louis-desire-romeo.berthier@michelin.com>",
    "download_url": "https://files.pythonhosted.org/packages/5a/54/ffa54acde666cd2033bf2aef91d274ea96b863e6ce2f81655c11dc464dff/torchsom-1.1.1.tar.gz",
    "platform": null,
    "description": "# `torchsom`: The Reference PyTorch Library for Self-Organizing Maps\n\n<div align=\"center\">\n\n<!-- Global Package information -->\n[![PyPI version](https://img.shields.io/pypi/v/torchsom.svg?color=blue)](https://pypi.org/project/torchsom/)\n[![Python versions](https://img.shields.io/pypi/pyversions/torchsom.svg?color=blue)](https://pypi.org/project/torchsom/)\n[![PyTorch versions](https://img.shields.io/badge/PyTorch-2.7-EE4C2C.svg)](https://pytorch.org/)\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/license/apache-2-0)\n\n<!-- Sonar Qube badges -->\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=michelin_TorchSOM&metric=coverage)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM)\n\n<!-- [![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-light.svg)](https://sonarcloud.io/summary/new_code?id=michelin_TorchSOM) -->\n\n<!-- GitHub Workflows -->\n[![Tests](https://github.com/michelin/TorchSOM/workflows/Tests/badge.svg)](https://github.com/michelin/TorchSOM/actions/workflows/test.yml)\n[![Code Quality](https://github.com/michelin/TorchSOM/workflows/Code%20Quality/badge.svg)](https://github.com/michelin/TorchSOM/actions/workflows/code-quality.yml)\n[![Downloads](https://static.pepy.tech/badge/torchsom)](https://pepy.tech/project/torchsom)\n[![GitHub stars](https://img.shields.io/github/stars/michelin/TorchSOM.svg?style=social&label=Star)](https://github.com/michelin/TorchSOM)\n<!-- [![Security](https://github.com/michelin/TorchSOM/workflows/Security%20Scanning/badge.svg)](https://github.com/michelin/TorchSOM/actions/workflows/security.yml) -->\n\n<!-- Code Style and Tools -->\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/imports-isort-6c757d.svg?color=blue)](https://pycqa.github.io/isort/)\n[![Ruff](https://img.shields.io/badge/linter-ruff-6c757d.svg?color=blue)](https://github.com/astral-sh/ruff)\n\n<p align=\"center\">\n    <img src=\"assets/logo.png\" alt=\"TorchSOM_logo\" width=\"400\"/>\n</p>\n\n**A modern, comprehensive and GPU-accelerated PyTorch implementation of Self-Organizing Maps for scalable ML workflows**\n\n[\ud83d\udcda Documentation](https://opensource.michelin.io/TorchSOM/)\n| [\ud83d\ude80 Quick Start](#-quick-start)\n| [\ud83d\udcca Examples](notebooks/)\n| [\ud83e\udd1d Contributing](CONTRIBUTING.md)\n<!-- | [\ud83d\udcc4 Paper (PDF)](assets/torchsom_jmlr.pdf) -->\n\n**\u2b50 If you find [`torchsom`](https://github.com/michelin/TorchSOM) valuable, please consider starring this repository \u2b50**\n\n</div>\n\n---\n\n## \ud83c\udfaf Overview\n\nSelf-Organizing Maps (SOMs) remain **highly relevant in modern machine learning** (ML) due to their **interpretability**, **topology preservation**, and **computational efficiency**. They excel and are widely used in domains such as energy systems, biology, internet of things (IoT), environmental science, and industrial applications.\n\nDespite their utility, the SOM ecosystem is fragmented. Existing implementations are often **outdated**, **unmaintained**, and **lack GPU acceleration or modern deep learning** (DL) **framework integration**, limiting adoption and scalability.\n\n**`torchsom`** addresses these gaps as a **reference PyTorch library** for SOMs. It provides:\n\n- **GPU-accelerated training**\n- **Advanced clustering capabilities**\n- A **scikit-learn-style API** for ease of use\n- **Rich visualization tools**\n- **Robust software engineering practices**\n\n`torchsom` enables researchers and practitioners to integrate SOMs seamlessly into workflows, from exploratory data analysis to advanced model architectures.\n\nThis library accompanies the paper: [`torchsom`: The Reference PyTorch Library for Self-Organizing Maps](assets/torchsom_jmlr.pdf). If you use `torchsom` in academic or industrial work, please cite both the paper and the software (see [`CITATION`](CITATION.cff)).\n\n> **Note**: See the comparison table below to understand how `torchsom` differs from other SOM libraries, and explore our [Visualization Gallery](#-visualization-gallery) for example outputs.\n\n## \u26a1 Why `torchsom`?\n\nUnlike legacy implementations, `torchsom` is engineered from the ground up for modern ML workflows:\n\n|  | [torchsom](https://github.com/michelin/TorchSOM) | [MiniSom](https://github.com/JustGlowing/minisom) | [SimpSOM](https://github.com/fcomitani/simpsom) | [SOMPY](https://github.com/sevamoo/SOMPY) | [somoclu](https://github.com/peterwittek/somoclu) | [som-pbc](https://github.com/alexarnimueller/som) |\n|---|---|---|---|---|---|---|\n| **Architecture Section** |  |  |  |  |  |  |\n| Framework | PyTorch | NumPy | NumPy | NumPy | C++/CUDA | NumPy |\n| GPU Acceleration |  \u2705 CUDA | \u274c | \u2705 CuPy/CUML | \u274c | \u2705 CUDA | \u274c |\n| API Design | scikit-learn | Custom | Custom | MATLAB | Custom | custom |\n| **Development Quality Section** |  |  |  |  |  |  |\n| Maintenance | \u2705 Active | \u2705 Active | \u26a0\ufe0f Minimal | \u26a0\ufe0f Minimal | \u26a0\ufe0f Minimal | \u274c |\n| Documentation | \u2705 Rich | \u274c | \u26a0\ufe0f Basic | \u274c | \u26a0\ufe0f Basic | \u26a0\ufe0f Basic |\n| Test Coverage | \u2705 ~86% | \u274c | \ud83d\udfe0 ~53% | \u274c | \u26a0\ufe0f Minimal | \u274c |\n| PyPI Distribution | \u2705 | \u2705 | \u2705 | \u274c | \u2705 | \u274c |\n| **Functionality Section** |  |  |  |  |  |  |\n| Visualization | \u2705 Advanced | \u274c | \ud83d\udfe0 Moderate | \ud83d\udfe0 Moderate | \u26a0\ufe0f Basic | \u26a0\ufe0f Basic |\n| Clustering | \u2705 Advanced | \u274c | \u274c | \u274c | \u274c | \u274c |\n| JITL support | \u2705 Built-in | \u274c | \u274c | \u274c | \u274c | \u274c |\n| SOM Variants | \ud83d\udea7 In development | \u274c | \ud83d\udfe0 PBC | \u274c | \ud83d\udfe0 PBC | \ud83d\udfe0 PBC |\n| Extensibility | \u2705 High | \ud83d\udfe0 Moderate | \u26a0\ufe0f Low | \u26a0\ufe0f Low | \u26a0\ufe0f Low | \u26a0\ufe0f Low |\n\n> **Note**: `torchsom` supports **Just-In-Time Learning (JITL)**.\n> Given an online query, JITL collects relevant datapoints to form a local buffer (selected first by topology, then by distance). A lightweight local model is then trained on this buffer, enabling efficient supervised learning (regression or classification).\n\n---\n\n## \ud83d\udcd1 Table of Contents\n\n- [Quick Start](#-quick-start)\n- [Tutorials](#-tutorials)\n- [Installation](#-installation)\n- [Documentation](#-documentation)\n- [Citation](#-citation)\n- [Contributing](#-contributing)\n- [Acknowledgments](#-acknowledgments)\n- [License](#-license)\n- [Related Work and References](#-related-work-and-references)\n<!-- - [Reproducibility](#-reproducibility) -->\n<!-- - [Performance Benchmarks](#-performance-benchmarks) -->\n\n---\n\n## \ud83d\ude80 Quick Start\n\nGet started with `torchsom` in just a few lines of code:\n\n```python\nimport torch\nfrom torchsom.core import SOM\nfrom torchsom.visualization import SOMVisualizer\n\n# Create a 10x10 map for 3D input\nsom = SOM(x=10, y=10, num_features=3, epochs=50)\n\n# Train SOM for 50 epochs on 1000 samples\nX = torch.randn(1000, 3)\nsom.initialize_weights(data=X, mode=\"pca\")\nQE, TE = som.fit(data=X)\n\n# Visualize results\nvisualizer = SOMVisualizer(som=som, config=None)\nvisualizer.plot_training_errors(quantization_errors=QE, topographic_errors=TE, save_path=None)\nvisualizer.plot_hit_map(data=X, batch_size=256, save_path=None)\nvisualizer.plot_distance_map(\n  save_path=None,\n  distance_metric=som.distance_fn_name,\n  neighborhood_order=som.neighborhood_order,\n  scaling=\"sum\"\n)\n```\n\n## \ud83d\udcd3 Tutorials\n\nExplore our comprehensive collection of Jupyter notebooks:\n\n- \ud83d\udcca [`iris.ipynb`](notebooks/iris.ipynb): Multiclass classification\n- \ud83c\udf77 [`wine.ipynb`](notebooks/wine.ipynb): Multiclass classification\n- \ud83c\udfe0 [`boston_housing.ipynb`](notebooks/boston_housing.ipynb): Regression\n- \u26a1 [`energy_efficiency.ipynb`](notebooks/energy_efficiency.ipynb): Multi-output regression\n- \ud83c\udfaf [`clustering.ipynb`](notebooks/clustering.ipynb): SOM-based clustering analysis\n\n### \ud83c\udfa8 Visualization Gallery\n\n<p align=\"center\">\n  <table>\n    <tr>\n      <td align=\"center\">\n        <b>\ud83d\uddfa\ufe0f D-Matrix Visualization</b><br>\n        <p>Michelin production line (regression)</p>\n        <img src=\"assets/michelin_dmatrix.png\" alt=\"U-Matrix\" width=\"220\"/>\n      </td>\n      <td align=\"center\">\n        <b>\ud83d\udccd Hit Map Visualization</b><br>\n        <p>Michelin production line (regression)</p>\n        <img src=\"assets/michelin_hitmap.png\" alt=\"Hit Map\" width=\"220\"/>\n      </td>\n      <td align=\"center\">\n        <b>\ud83d\udcca Mean Map Visualization</b><br>\n        <p>Michelin production line (regression)</p>\n        <img src=\"assets/michelin_meanmap.png\" alt=\"Mean Map\" width=\"220\"/>\n      </td>\n    </tr>\n    <tr>\n      <td align=\"center\" colspan=\"2\">\n        <b>\ud83d\uddfa\ufe0f Component Planes Visualization</b><br>\n        <p>Another Michelin line (regression)</p>\n        <table>\n          <tr>\n            <td align=\"center\">\n              <img src=\"assets/michelin_cp12.png\" alt=\"Component Plane 1\" width=\"220\"/>\n            </td>\n            <td align=\"center\">\n              <img src=\"assets/michelin_cp21.png\" alt=\"Component Plane 2\" width=\"220\"/>\n            </td>\n          </tr>\n        </table>\n      </td>\n      <td align=\"center\">\n        <b>\ud83c\udff7\ufe0f Classification Map</b><br>\n        <p>Wine dataset (multi-classification)</p>\n        <img src=\"assets/wine_classificationmap.png\" alt=\"Classification Map\" width=\"220\"/>\n      </td>\n    </tr>\n    <tr>\n      <td align=\"center\">\n        <b>\ud83d\udcca Cluster Metrics</b><br>\n        <p>Clustering analysis</p>\n        <img src=\"assets/cluster_metrics.png\" alt=\"Cluster Metrics\" width=\"220\"/>\n      </td>\n      <td align=\"center\">\n        <b>\ud83d\udcc8 K-Means Elbow</b><br>\n        <p>Optimal cluster selection</p>\n        <img src=\"assets/kmeans_elbow.png\" alt=\"K-Means Elbow\" width=\"220\"/>\n      </td>\n      <td align=\"center\">\n        <b>\ud83c\udfaf HDBSCAN Cluster Map</b><br>\n        <p>Cluster visualization</p>\n        <img src=\"assets/hdbscan_cluster_map.png\" alt=\"HDBSCAN Cluster Map\" width=\"220\"/>\n      </td>\n    </tr>\n  </table>\n</p>\n\n---\n\n## \ud83d\udcbe Installation\n\n### \ud83d\udce6 PyPI\n\n```bash\npip install torchsom\n```\n\n### \ud83d\udd27 Development Version\n\n```bash\ngit clone https://github.com/michelin/TorchSOM.git\ncd TorchSOM\npython3.9 -m venv .torchsom_env\nsource .torchsom_env/bin/activate\npip install -e \".[all]\"\n```\n\n---\n\n## \ud83d\udcda Documentation\n\nComprehensive documentation is available at [opensource.michelin.io/TorchSOM](https://opensource.michelin.io/TorchSOM/)\n\n---\n\n## \ud83d\udcdd Citation\n\nIf you use `torchsom` in your academic, research or industrial work, please cite both the paper and software:\n\n```bibtex\n@inproceedings{Berthier2025TorchSOM,\n    title={torchsom: The Reference PyTorch Library for Self-Organizing Maps},\n    author={Berthier, Louis},\n    booktitle={Conference Name},\n    year={2025}\n}\n\n@software{Berthier_TorchSOM_The_Reference_2025,\n    author={Berthier, Louis},\n    title={torchsom: The Reference PyTorch Library for Self-Organizing Maps},\n    url={https://github.com/michelin/TorchSOM},\n    version={1.0.0},\n    year={2025}\n}\n```\n\nFor more details, please refer to the [CITATION](CITATION.cff) file.\n\n---\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions from the community! See our [Contributing Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md) for details.\n\n- **GitHub Issues**: [Report bugs or request features](https://github.com/michelin/TorchSOM/issues)\n<!-- - **GitHub Discussions**: [Ask questions and share ideas](https://github.com/michelin/TorchSOM/discussions) -->\n\n---\n\n## \ud83d\ude4f Acknowledgments\n\n- [Centre de Math\u00e9matiques Appliqu\u00e9es (CMAP)](https://cmap.ip-paris.fr/) at \u00c9cole Polytechnique\n- [Manufacture Fran\u00e7aise des Pneumatiques Michelin](https://www.michelin.com/) for collaboration\n- [Giuseppe Vettigli](https://github.com/JustGlowing) for [MiniSom](https://github.com/JustGlowing/minisom) inspiration\n- The [PyTorch](https://pytorch.org/) team for the amazing framework\n- Logo created using [DALL-E](https://openai.com/index/dall-e-3/)\n\n---\n\n## \ud83d\udcc4 License\n\n`torchsom` is licensed under the [Apache License 2.0](LICENSE). See the [LICENSE](LICENSE) file for details.\n\n---\n\n## \ud83d\udcda Related Work and References\n\n### \ud83d\udcd6 Foundational Literature Papers\n\n- Kohonen, T. (2001). [Self-Organizing Maps](https://link.springer.com/book/10.1007/978-3-642-56927-2). Springer.\n\n### \ud83d\udd17 Related Softwares\n\n- [MiniSom](https://github.com/JustGlowing/minisom): Minimalistic Python SOM\n- [SimpSOM](https://github.com/fcomitani/simpsom):Simple Self-Organizing Maps\n- [SOMPY](https://github.com/sevamoo/SOMPY): Python SOM library\n- [somoclu](https://github.com/peterwittek/somoclu): Massively Parallel Self-Organizing Maps\n- [som-pbc](https://github.com/alexarnimueller/som): A simple self-organizing map implementation in Python with periodic boundary conditions\n- [SOM Toolbox](http://www.cis.hut.fi/projects/somtoolbox/): MATLAB implementation\n\n---\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "torchsom: The Reference PyTorch Library for Self-Organizing Maps",
    "version": "1.1.1",
    "project_urls": {
        "Citation": "https://github.com/michelin/TorchSOM/blob/main/CITATION.cff",
        "Code of Conduct": "https://github.com/michelin/TorchSOM/blob/main/CODE_OF_CONDUCT.md",
        "Contributing": "https://github.com/michelin/TorchSOM/blob/main/CONTRIBUTING.md",
        "Documentation": "https://opensource.michelin.io/TorchSOM/",
        "License": "https://github.com/michelin/TorchSOM/blob/main/LICENSE",
        "Source": "https://github.com/michelin/torchsom",
        "Tracker": "https://github.com/michelin/TorchSOM/issues"
    },
    "split_keywords": [
        "self-organizing-maps",
        " som",
        " pytorch",
        " machine-learning",
        " unsupervised-learning",
        " dimensionality-reduction",
        " clustering",
        " data-visualization",
        " just-in-time-learning"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c8223b863869e9109ca4da2dc078355bdd4ee8c96f959d84a9ff44d49ae704ae",
                "md5": "88c9f33df41094995900f6c0b20e5872",
                "sha256": "3b640671ebc114193bed418729ef5243a70c55b6627100ae3c1ce48cd4e59d1d"
            },
            "downloads": -1,
            "filename": "torchsom-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "88c9f33df41094995900f6c0b20e5872",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 58787,
            "upload_time": "2025-09-01T14:20:19",
            "upload_time_iso_8601": "2025-09-01T14:20:19.154928Z",
            "url": "https://files.pythonhosted.org/packages/c8/22/3b863869e9109ca4da2dc078355bdd4ee8c96f959d84a9ff44d49ae704ae/torchsom-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5a54ffa54acde666cd2033bf2aef91d274ea96b863e6ce2f81655c11dc464dff",
                "md5": "93859caf2f30eafeb2fc440a3d012ce2",
                "sha256": "2aa021f8b8e615f5869d2266d64f1fba7ef8e7a4acde76e3576c4da7c1bae1e2"
            },
            "downloads": -1,
            "filename": "torchsom-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "93859caf2f30eafeb2fc440a3d012ce2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 56428,
            "upload_time": "2025-09-01T14:20:20",
            "upload_time_iso_8601": "2025-09-01T14:20:20.513037Z",
            "url": "https://files.pythonhosted.org/packages/5a/54/ffa54acde666cd2033bf2aef91d274ea96b863e6ce2f81655c11dc464dff/torchsom-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-01 14:20:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "michelin",
    "github_project": "TorchSOM",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "torchsom"
}
        
Elapsed time: 2.16824s