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.6.tar.gz (566.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.6-py3-none-any.whl (392.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for manylatents-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e63bf5e0bf7ffed1ead667a42d84bdffdad90d21bf22e04dbd75bf923d2cd1cc
MD5 e037d6b3387e04929ba1c973570e48b5
BLAKE2b-256 1d10bd86f7de5c61359ed38d5f9723c1cf12601e69f48c0e864b6d9c7d4e60ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for manylatents-0.1.6.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.6-py3-none-any.whl.

File metadata

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

File hashes

Hashes for manylatents-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0501fbcc6e9f7d6ff2be82c289be5049b1cfd82c86da95abada1806b4a8180ea
MD5 c734c1518be9242842a4da2aebd661dc
BLAKE2b-256 c072852713f698d544e7faca7e703fe6f7f8f85d1d2e0b36863577bb4bcf474b

See more details on using hashes here.

Provenance

The following attestation bundles were made for manylatents-0.1.6-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