Skip to main content

Blazing fast implementation of the Thema algorithm.

Project description

Pulsar

Rust-backed Python library for topological data analysis. Implements the Thema pipeline: imputation → scaling → PCA → Ball Mapper → Cosmic Graph.

Performance-critical algorithms are written in Rust (PyO3/maturin) and exposed as pulsar._pulsar. Python orchestrates the pipeline.

Installation

Requires Rust and Python 3.10+.

uv sync
uv run maturin develop --release

Quick start

from pulsar import ThemaRS

model = ThemaRS("params.yaml").fit()

graph = model.cosmic_graph        # networkx.Graph with 'weight' edge attributes
adj   = model.weighted_adjacency  # np.ndarray, shape (n, n)
reps  = model.select_representatives()  # uses the configured default

Copy params.yaml.sample to params.yaml and edit it for your dataset.

Demos

Demo scripts and their parameter files live under demos/:

  • demos/coal.py with demos/coal_params.yaml
  • demos/physionet.py with demos/physionet_params.yaml

Run the coal demo (US Coal Plants):

uv run python demos/coal.py

Run the PhysioNet demo (synthetic mode):

uv run python demos/physionet.py --synthetic

Run the PhysioNet demo with a real eICU CSV export:

uv run python demos/physionet.py --data path/to/eicu_patient_static.csv

Configuration

Cosmic graph thresholding is automatic by default, and representative selection has a sensible default. Most users only need to configure data, preprocessing, and sweeps.

run:
  name: my_experiment
  data: path/to/data.csv # CSV or parquet

preprocessing:
  drop_columns: [id, timestamp]
  impute:
    age:
      method: sample_normal # fill_mean | fill_median | fill_mode |
      seed: 42 # sample_normal | sample_categorical
    category:
      method: sample_categorical
      seed: 7

sweep:
  pca:
    dimensions:
      values: [2, 3, 5]
    seed:
      values: [42, 7, 13]
  ball_mapper:
    epsilon:
      range: { min: 0.1, max: 1.5, steps: 8 } # or: values: [0.3, 0.5, 0.8]

Development

uv run maturin develop        # debug build
uv run maturin develop --release  # optimised build
uv run pytest tests/ -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

thema_pulsar-0.1.0.tar.gz (55.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

thema_pulsar-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (403.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

Details for the file thema_pulsar-0.1.0.tar.gz.

File metadata

  • Download URL: thema_pulsar-0.1.0.tar.gz
  • Upload date:
  • Size: 55.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for thema_pulsar-0.1.0.tar.gz
Algorithm Hash digest
SHA256 03014f88da28d2c33bd9063dcaac102f04502fd81ba6b28bcbbf8c8a672415e9
MD5 c8d48ca8c34f663903c97a5a088338e2
BLAKE2b-256 b50b0b1b7f7410f3e5b3712da3d7743693e5c3dc86a6716646b609de90224ed6

See more details on using hashes here.

File details

Details for the file thema_pulsar-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

  • Download URL: thema_pulsar-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 403.0 kB
  • Tags: CPython 3.13, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for thema_pulsar-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 426998c3c0d84eb54330fd5e008dd6047fd621fa54192c1d0ee0dd06ba055578
MD5 ffa46e7adf1c8cb4d6788e0a7c11f86e
BLAKE2b-256 5003a04fd30bd2e418b50a7fbf677fbbdd6fda2841bae2d7f27a6d38efb83073

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page