Skip to main content

Unified dimensionality reduction and neural network analysis framework

Project description

     .  . .
  .  .. . . ..       .  . .
 . . .  . .. . . -->  . .. .  -->  λ(·)
  . ..  . .  .       .  . .
    .  . .

        m a n y l a t e n t s

  one geometry, learned through many latents

license python uv PyPI


install

uv add manylatents

Optional extras:

uv add manylatents[hf]         # HuggingFace trainer
uv add manylatents[torchdr]    # GPU-accelerated DR via TorchDR
uv add manylatents[jax]        # JAX backend (diffrax)
uv add manylatents[all]        # everything
pip also works
pip install manylatents

quickstart

# embed a swiss roll with UMAP
manylatents algorithms/latent=umap data=swissroll

# add metrics
manylatents algorithms/latent=umap data=swissroll \
  metrics=trustworthiness

# sweep algorithms
manylatents --multirun \
  algorithms/latent=umap,phate,tsne \
  data=swissroll metrics=trustworthiness
development install
git clone https://github.com/latent-reasoning-works/manylatents.git
cd manylatents && uv sync
from manylatents.api import run

result = run(data="swissroll", algorithm="pca", metrics=["trustworthiness"])

embeddings = result["embeddings"]   # (n, d) ndarray
scores     = result["scores"]       # {"trustworthiness": 0.95}

# chain: PCA 50d -> PHATE 2d
result2 = run(input_data=result["embeddings"], algorithm="phate")

architecture

  CLI                         API
  manylatents ...             run(data=, algorithm=, ...)
       │                           │
       ▼                           ▼
  ┌─────────┐               ┌───────────┐
  │ main.py │               │  api.py   │
  │ Hydra   │               │ registries│
  └────┬────┘               └─────┬─────┘
       │    instantiate objects    │
       └──────────┬───────────────┘
                  ▼
        ┌──────────────────┐      ┌────────────────┐
        │  experiment.py   │─────►│  evaluate.py   │
        │  run_experiment()│      │  evaluate()    │
        │                  │      │  prewarm_cache │
        │  LatentModule    │      │  compute_knn   │
        │    fit/transform │      │  metric_fn(    │
        │  LightningModule │      │   cache=cache) │
        │    trainer.fit   │      └────────────────┘
        └──────────────────┘

Two base classes, one decision rule:

if the algorithm... use interface
has no training loop LatentModule fit(x) / transform(x)
trains with backprop LightningModule trainer.fit() / encode(x)

Both produce LatentOutputs — a dict keyed by "embeddings". All metrics receive a shared cache dict for deduplicated kNN and eigenvalue computation.


algorithms

17 algorithms -- 12 latent modules, 5 lightning modules

PCA, t-SNE, UMAP, PHATE, DiffusionMap, MDS, MultiscalePHATE, Merging, Classifier, Leiden, ReebGraph, SelectiveCorrection, Autoencoder, AANet, LatentODE, HF Trainer, Reconstruction AE.

neighborhood_size=k sweeps kNN uniformly across algorithms.


metrics

20+ metrics across three evaluation contexts

Embedding fidelity (trustworthiness, continuity, kNN preservation), spectral analysis (affinity spectrum, spectral decay rate), topological features (persistent homology), and dataset properties (stratification).

All metrics share a cache dict for deduplicated kNN computation. List-valued parameters expand via flatten_and_unroll_metrics() -- one kNN computation covers the entire sweep.

Config pattern: metrics=<name> (each metric config has an at: field for evaluation context)


data

6 synthetic manifolds + precomputed loader

Swiss roll, torus, saddle surface, gaussian blobs, DLA tree, and custom .npy/.npz files. Domain-specific datasets (genomics, single-cell) available via extensions.


citing

If manylatents was useful in your research, a citation goes a long way:

@software{manylatents2026,
  title     = {manyLatents: Unified Dimensionality Reduction and Neural Network Analysis},
  author    = {Valdez C{\'o}rdova, C{\'e}sar Miguel and Scicluna, Matthew and Ni, Shuang},
  year      = {2026},
  url       = {https://github.com/latent-reasoning-works/manylatents},
  license   = {MIT}
}



MIT License · Latent Reasoning Works

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

manylatents-0.1.5.tar.gz (509.6 kB view details)

Uploaded Source

Built Distribution

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

manylatents-0.1.5-py3-none-any.whl (355.6 kB view details)

Uploaded Python 3

File details

Details for the file manylatents-0.1.5.tar.gz.

File metadata

  • Download URL: manylatents-0.1.5.tar.gz
  • Upload date:
  • Size: 509.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for manylatents-0.1.5.tar.gz
Algorithm Hash digest
SHA256 725d3e5bf32586a0d19614c6615d21d0203765e840972f5e22c74cb4ce12a2c9
MD5 4ee20e045de3f8fc6aef2d1813e91c14
BLAKE2b-256 0d8bb0c8c147bd553e7c24494bdde7bbd680fbc0423f8ad5648f4928e9cda00b

See more details on using hashes here.

Provenance

The following attestation bundles were made for manylatents-0.1.5.tar.gz:

Publisher: publish.yml on latent-reasoning-works/manylatents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file manylatents-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: manylatents-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 355.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for manylatents-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 200367977e17e5a2b9203fdc4153dc5fe8a4664636382153d3876d50b8e175aa
MD5 52628a997d79f14cc8ed00d5245b023f
BLAKE2b-256 a4b6e0d1f579ad86fe8d041adc7980a5f4782a8f2ff41833b49524c2d703f717

See more details on using hashes here.

Provenance

The following attestation bundles were made for manylatents-0.1.5-py3-none-any.whl:

Publisher: publish.yml on latent-reasoning-works/manylatents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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