About topometry-nosc
Provenance.
topometry-noscis an independently maintained, heavily modified fork of TopOMetry by David S Oliveira (original copyright and MIT license preserved). Its API, internals and behaviour may differ substantially from upstream. It is not an official release of, affiliated with, or endorsed by the original project. The import package is still namedtopo, so it cannot be installed alongside the upstreamtopometrydistribution in the same environment. Please cite both this fork and the original work (seeCITATION.cff).
topometry-nosc is a Python toolkit for Manifold Learning, Dimensionality Reduction, and Spectral Clustering. It explores high-dimensional data by approximating the Laplace-Beltrami Operator (LBO) via Continuous k-Nearest Neighbors (CkNN) and Diffusion Maps. The pipeline learns neighborhood graphs → Laplace–Beltrami–type operators → spectral scaffolds → refined graphs to find clusters and build low-dimensional layouts.
- scikit-learn–style transformers compatible with standard machine learning workflows
- Diffusion Maps and multiscale spectral scaffolds for geometry preservation
- Operator-native metrics to quantify geometry preservation and Riemannian diagnostics to evaluate distortion in visualizations
- Designed for large, diverse datasets
For background, see the original paper: https://doi.org/10.7554/eLife.100361.2
Geometry-first rationale (short)
We approximate the Laplace–Beltrami operator (LBO) by learning well-weighted similarity graphs and their Laplacian/diffusion operators. The eigenfunctions of these operators form an orthonormal basis—the spectral scaffold—that captures the dataset’s intrinsic geometry across scales. This view connects to Diffusion Maps, Laplacian Eigenmaps, and related kernel eigenmaps, and enables downstream tasks such as clustering and graph-layout optimization with geometry preserved.
When to use TopoMetry
Use TopoMetry when you want:
- Geometry-faithful representations beyond variance maximization (e.g., PCA)
- Robust low-dimensional views and clustering from operator-grounded features
- Quantitative operator-native metrics to compare methods and parameter choices
- Reproducible, non-destructive pipelines
Empirically, TopoMetry often outperforms PCA-based pipelines and stand-alone layouts. Still, let the data decide—TopoMetry includes metrics and reports to support evidence-based choices.
For practical guidance on UMAP vs. TopoMetry, target-aware embedding checks, and
layout troubleshooting, see docs/faq.md.
When not to use TopoMetry
- Very small sample sizes where the manifold hypothesis is weak
- Workflows needing streaming/online updates or inverse transforms (embedding new points without recomputing operators is not currently supported). If that’s critical, consider UMAP or parametric/autoencoder approaches—and you can still use TopoMetry to audit geometry or estimate intrinsic dimensionality to guide model design.
Installation
topometry-nosc is a standard, pip-installable package. The core install depends on numpy, scipy, scikit-learn, numba, joblib, matplotlib, pandas, and jupyterlab:
pip install topometry-nosc # core
pip install "topometry-nosc[all]" # core + ANN backends and extra layouts
Optional features are grouped into extras — install only what you need:
| Extra | Adds |
|---|---|
ann |
hnswlib (fast approximate nearest neighbors) |
amg |
pyamg (algebraic-multigrid eigensolver='amg') |
layouts |
pacmap, pymde, trimap (extra projections) |
all |
everything above |
Missing an optional dependency raises a clear message telling you which extra to
install (e.g. pip install topometry-nosc[layouts]).
Development install
This project uses uv:
uv sync --all-extras # package + all extras + dev tooling
uv run pytest -q # run the tests
Tutorials and documentation
Documentation for this fork: https://HauserGroup.github.io/topometryNoSC/ (installation, quickstart, concepts, and an auto-generated API reference).
The original upstream project's (OLD) documentation may still be useful for background, but describes the upstream API, which differs from this fork.
Minimal example
import topo as tp
from sklearn.datasets import make_swiss_roll
X, color = make_swiss_roll(n_samples=2000, noise=0.5, random_state=42)
# Fit runs the whole pipeline: kNN -> kernel -> eigenbasis -> scaffold ->
# refined graph -> 2-D layouts (defaults: MAP + PaCMAP).
tg = tp.TopOGraph()
tg.fit(X)
# Layouts computed during fit, available as attributes:
print(tg.TopoMAP.shape) # (2000, 2)
print(tg.msTopoPaCMAP.shape) # (2000, 2)
# Compute another layout on demand from the same fitted model:
emb = tg.project(projection_method="PaCMAP")
Step-by-step (under the hood)
TopOGraph.fit above chains four building blocks. Each is a standalone,
scikit-learn-style estimator you can use on its own — swap one out, stop early,
or feed your own matrices in:
from sklearn.datasets import make_swiss_roll
from topo.base.ann import kNN
from topo.tpgraph.kernels import Kernel
from topo.spectral.eigen import EigenDecomposition
from topo.layouts.projector import Projector
X, color = make_swiss_roll(n_samples=2000, noise=0.5, random_state=42)
# 1. k-nearest-neighbor graph (sparse). Useful on its own.
knn_graph = kNN(X, n_neighbors=15, metric="euclidean")
# 2. Affinity kernel -> Laplace-Beltrami-type operator.
kernel = Kernel(n_neighbors=15, metric="euclidean").fit(X)
affinity = kernel.K # sparse affinity matrix
operator = kernel.P # diffusion operator
# 3. Spectral scaffold: eigendecompose the operator (diffusion maps).
eig = EigenDecomposition(n_components=20, method="DM").fit(kernel)
scaffold = eig.transform(kernel) # (2000, ~20) eigen-coordinates
# 4. 2-D layout from the scaffold (any feature matrix works here).
emb = Projector(n_components=2, projection_method="MAP").fit_transform(scaffold)
print(emb.shape) # (2000, 2)
Each step maps to a documented class: kNN, Kernel, EigenDecomposition,
Projector. See the API reference
and the step-by-step tutorial.
Output
Example TopOGraph fit:
Changelog
0.3.1 — Dependency refresh and documentation build migrated to Zensical
0.3.0 — First PyPI release
- Published to PyPI as
topometry-nosc - Simplified internals delegate to scikit-learn/SciPy/umap-learn where possible; slimmer runtime dependencies (ANN backends and extra layouts are opt-in extras)
- Standalone building blocks (
kNN,Kernel,cknn_graph,EigenDecomposition,LE,Projector) usable and tested outside theTopOGraphorchestrator
See CHANGELOG.md for the full history.
Citation
@article{Oliveira_2024,
title={TopoMetry systematically learns and evaluates the latent geometry of single-cell data},
volume={13},
ISSN={2050-084X},
url={http://dx.doi.org/10.7554/eLife.100361.2},
DOI={10.7554/elife.100361.2},
journal={eLife},
publisher={eLife Sciences Publications, Ltd},
author={Oliveira, David S and Domingos, Ana I and Velloso, Licio A},
year={2024},
month=aug
}
Metadata
Release files for topometry-nosc 0.3.1
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 |
|---|---|---|---|---|
| topometry_nosc-0.3.1.tar.gz | 437.5 kB | With provenance | Details for topometry_nosc-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| topometry_nosc-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for topometry_nosc-0.3.1-py3-none-any.whl |
Total release size: 867.1 kB
Release files / topometry_nosc-0.3.1.tar.gz
| Download URL | topometry_nosc-0.3.1.tar.gz |
|---|---|
| Size | 437.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1d50df32110f7dbf7cae00d9f397ee2b421a6c5fb2d91170c0fb45bbb775d89
|
|
BLAKE2b-256 checksum How to use checksums |
0f88a63803b17fa91261ae5e06b9fcc3ec986181394935263ecf86c43742b487
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / topometry_nosc-0.3.1-py3-none-any.whl
| Download URL | topometry_nosc-0.3.1-py3-none-any.whl |
|---|---|
| Size | 429.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64d5af6af817b0b0d971426bea51f1d5989d9ae6d3c927e466c0c2817d85d8ee
|
|
BLAKE2b-256 checksum How to use checksums |
ba6b0ac8ba7e0f3c70a38a13b5e92c70b910c9ef5c265bcd7544433258dd421e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for topometry-nosc 0.3.1
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for topometry_nosc-0.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA 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.