XPySom-dask
Self Organizing Maps with Dask Support and pretty hexagonal plot.
Simpsom-Dask is a partial rewrite of XPySom-Dask with vizualisation elements introduced in Simpsom. Some optimizations have been added, and the vizualisation elements have been improved, mostly to fit my needs.
Installation
You can download XPySom-dask from PyPi:
pip install simpsom-dask
By default, dependencies for GPU execution are not downloaded.
You can also choose to clone this repo and then run
cd simpsom-dask
pip install -e .
if you would like to modify things on the fly.
How to use it
The module interface is similar to MiniSom. In the following only the basics of the usage are reported, for an overview of all the features, please refer to the original MiniSom examples you can refer to: https://github.com/JustGlowing/minisom/tree/master/examples (you can find the same examples also in this repository but they have not been updated yet).
In order to use Simpsom you need your data organized as a Numpy matrix where each row corresponds to an observation or as list of lists like the following:
chunks = (4, 2)
data = [[ 0.80, 0.55, 0.22, 0.03],
[ 0.82, 0.50, 0.23, 0.03],
[ 0.80, 0.54, 0.22, 0.03],
[ 0.80, 0.53, 0.26, 0.03],
[ 0.79, 0.56, 0.22, 0.03],
[ 0.75, 0.60, 0.25, 0.03],
[ 0.77, 0.59, 0.22, 0.03]]
Then you can train XPySom just as follows:
from simsom_dask import Simpsom
import dask.array as da
from dask.distributed import Client, LocalCluster
client = Client(LocalCluster())
dask_data = da.from_array(data, chunks=chunks)
som = Simpsom(6, 6, 4, sigma=0.3, learning_rate=0.5, use_dask=True, chunks=chunks) # initialization of 6x6 SOM
som.train(dask_data, 100) # trains the SOM with 100 iterations
You can obtain the position of the winning neuron on the map for a given sample as follows:
som.winner(data[0])
Differences with MiniSom
- The batch SOM algorithm is used (instead of the online used in MiniSom). Therefore, use only
trainto train the SOM,train_randomandtrain_batchare not present. decay_functioninput parameter is no longer a function but one of'linear','exponential','asymptotic'. As a consequence of this change,sigmaNandlearning_rateNhave been added as input parameters to represent the values at the last iteration.- New input parameter
std_coeff, used to calculate gaussian exponent denominatord = 2*std_coeff**2*sigma**2. Default value is 0.5 (as in Somoclu, which is different from MiniSom original value sqrt(pi)). - New input parameter
xp(default =cupymodule). Back-end to use for computations. - New input parameter
n_parallelto set size of the mini-batch (how many input samples to elaborate at a time). - Hexagonal grid support is recommended.
Authors
Copyright (C) 2025 Hugo Banderier
Metadata
Release files for simpsom-dask 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simpsom_dask-1.0.3.tar.gz | 29.1 kB | Without provenance | Details for simpsom_dask-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simpsom_dask-1.0.3-py3-none-any.whl | Python 3 | none | any | Details for simpsom_dask-1.0.3-py3-none-any.whl |
Total release size: 59.0 kB
Release files / simpsom_dask-1.0.3.tar.gz
| Download URL | simpsom_dask-1.0.3.tar.gz |
|---|---|
| Size | 29.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
389f10e005b9599e9af335f066966eae98840f8f73e4261d96bdf9bfda145cde
|
|
BLAKE2b-256 checksum How to use checksums |
a0768cd3bdcacdf0034e05e22d4dac119dd9481401747c4f9828d680034e2060
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Release files / simpsom_dask-1.0.3-py3-none-any.whl
| Download URL | simpsom_dask-1.0.3-py3-none-any.whl |
|---|---|
| Size | 29.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ae3cf9a9bc12ddc9955bc82d6a3ad18e39f59b0dc01f7694094d5411531a6cf
|
|
BLAKE2b-256 checksum How to use checksums |
0c33109d68bb2fe9904ea19c34a38dccd9704892ac2cd66b51d3fdab0139d31f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Security for simpsom-dask 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.