Skip to main content

flowsom-rs

Rust SOM training for FlowSOM, via PyO3.

Implements the batch-learning SOM from Otsuka et al. 2025 with rayon parallelism. Unlike FlowSOM's online SOM, the batch algorithm processes all events simultaneously each epoch, so results are deterministic regardless of input event order.

Install

pip install flowsom-rs

Requires Python ≥ 3.10 and numpy ≥ 1.24.

Quick start

import numpy as np
import flowsom_rs
from scipy.spatial.distance import pdist, squareform

data = np.random.randn(500_000, 7)

# SOM grid setup (same format FlowSOM_Python uses)
grid = [(x, y) for x in range(10) for y in range(10)]
nhbrdist = squareform(pdist(grid, metric="chebyshev"))
radii = (np.quantile(nhbrdist, 0.67), 0.0)
codes = data[np.random.choice(len(data), 100, replace=False)]

# Train
codes, bmu_idx, bmu_dist = flowsom_rs.train_batch_som(
    data, codes, nhbrdist, radii, rlen=10
)

Functions

train_batch_som(data, codes, nhbrdist, radii, rlen, n_threads=None) Batch-learning SOM. Parallel BMU search + accumulation. Deterministic. Returns (codes, bmu_indices, bmu_distances).

train_online_som(data, codes, nhbrdist, alphas, radii, rlen, seed) Sequential Kohonen SOM, same algorithm as FlowSOM_Python's SOMEstimator.

train_replicas_som(data, codes, nhbrdist, alphas, radii, rlen, num_replicas=10, seed=42, n_threads=None) Parallel replicas merged via median, same approach as FlowSOM_Python's BatchSOMEstimator.

map_data_to_codes(data, codes) Parallel nearest-code assignment. Returns (indices, distances).

Benchmarks

10×10 grid, 10 epochs, Apple Silicon:

Events Numba Online Rust Batch Speedup
50K 364 ms 44 ms 5.9×
100K 491 ms 85 ms 6.4×
500K 2,709 ms 391 ms 6.9×

Thread scaling at 500K events: 1→2→4→8 threads gives 1.0→2.0→3.3→4.6× speedup.

Build from source

pip install maturin
maturin develop --release

License

MIT

Metadata

Release files for flowsom-rs 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flowsom-rs 0.1.0
File Size Uploaded Provenance Actions
flowsom_rs-0.1.0.tar.gz 13.0 kB Without provenance Details for flowsom_rs-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for flowsom-rs 0.1.0
File Actions
flowsom_rs-0.1.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details for flowsom_rs-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
flowsom_rs-0.1.0-cp314-cp314-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 macOS 10.12+ x86-64 Details for flowsom_rs-0.1.0-cp314-cp314-macosx_10_12_x86_64.whl
flowsom_rs-0.1.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details for flowsom_rs-0.1.0-cp312-cp312-win_amd64.whl
flowsom_rs-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details for flowsom_rs-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Total release size: 1.2 MB

Release files / flowsom_rs-0.1.0.tar.gz

Download URL flowsom_rs-0.1.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6e2c1fa82aea328ef1b0633114f738b2d1ab18eeef87676d053e8a8cb70762d2
BLAKE2b-256 checksum
How to use checksums
7623f66c1514c1483f0b9d5c1c164546520c0385d9be328c713820e3840a59af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / flowsom_rs-0.1.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL flowsom_rs-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
Size 309.2 kB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
51c7aea7c7a371bdd027f949dc3486edc44d28d92adf9913b4b81a3b62945580
BLAKE2b-256 checksum
How to use checksums
b71a9890424c67b5e1be458c1b7e2fa2e7ebd5bce6d6db03297eba3c56674b58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / flowsom_rs-0.1.0-cp314-cp314-macosx_10_12_x86_64.whl

Download URL flowsom_rs-0.1.0-cp314-cp314-macosx_10_12_x86_64.whl
Size 324.3 kB
Tags CPython 3.14 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5b282854696166400a9287a3ceeaf9da9af394fb1a505f339fae507873e66f05
BLAKE2b-256 checksum
How to use checksums
420593b52c6b84db35890712e176ef2bd03df5dcbd6eb08ae5fc004a05c1cd4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / flowsom_rs-0.1.0-cp312-cp312-win_amd64.whl

Download URL flowsom_rs-0.1.0-cp312-cp312-win_amd64.whl
Size 226.1 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
f786f9d36790c37e3407f9d9f7686ac770ebb7380de44c888ebba5194bdeb26d
BLAKE2b-256 checksum
How to use checksums
5d8d0884d978b23fd0e6b7bbfdd6a093fe815d4f7433fa05c9f98fb08fcbe1b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / flowsom_rs-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL flowsom_rs-0.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 355.3 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
068ca3c269a81283813dac76666d3ddc4f0d3e3559f600a287bfbe284b964d37
BLAKE2b-256 checksum
How to use checksums
12c0d4ad2052eb87af7b6334fafa177c70b86a59632a924a48717f383967c9f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for flowsom-rs 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

5 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page