Manify is a Python library for generating graph/data embeddings and performing machine learning in product spaces with mixed curvature (hyperbolic, Euclidean, and spherical spaces). It provides tools for manifold creation, curvature estimation, embedding generation, and predictive modeling that respects the underlying geometry of complex data.
You can read our manuscript here: Manify: A Python Library for Learning Non-Euclidean Representations
- Create and manipulate manifolds with different curvatures (hyperbolic, Euclidean, spherical)
- Build product manifolds by combining multiple spaces with different geometric properties
- Learn embeddings of data in these manifolds
- Train machine learning models that respect the geometry of the embedding space
- Generate synthetic data with known geometric properties for benchmarking
There are two ways to install manify
:
-
From PyPI:
pip install manify
-
From GitHub:
pip install git+https://github.com/pchlenski/manify
import torch
from manify.manifolds import ProductManifold
from manify.embedders import coordinate_learning
from manify.predictors.decision_tree import ProductSpaceDT
from manify.utils import dataloaders
# Load graph data
graph_dists, graph_labels, _ = dataloaders.load("polblogs")
# Create product manifold
signature = [(1, 4)] # Spherical manifold
pm = ProductManifold(signature=signature)
# Learn embeddings
embeddings, _ = coordinate_learning.train_coords(
pm,
graph_dists / graph_dists.max(),
burn_in_iterations=1000,
training_iterations=9000
)
# Train classifier
tree = ProductSpaceDT(pm=pm, max_depth=3)
tree.fit(embeddings, graph_labels)
Manifold Operations
manify.manifolds
- Tools for generating Riemannian manifolds and product manifolds
Curvature Estimation
manify.curvature_estimation.delta_hyperbolicity
- Compute delta-hyperbolicity of a metric spacemanify.curvature_estimation.greedy_method
- Greedy selection of signaturesmanify.curvature_estimation.sectional_curvature
- Sectional curvature estimation using Toponogov's theorem
Embedders
manify.embedders.coordinate_learning
- Coordinate learning and optimizationmanify.embedders.siamese
- Siamese network embeddermanify.embedders.vae
- Product space variational autoencoder
Predictors
manify.predictors.decision_tree
- Decision tree and random forest predictorsmanify.predictors.kappa_gcn
- Kappa GCNmanify.predictors.perceptron
- Product space perceptronmanify.predictors.svm
- Product space SVM
Utilities
manify.utils.benchmarks
- Tools for benchmarkingmanify.utils.dataloaders
- Loading datasetsmanify.utils.link_prediction
- Preprocessing graphs with link predictionmanify.utils.visualization
- Tools for visualization
Manify implements geometric machine learning approaches described in academic papers, particularly focusing on handling data with mixed geometric properties. It's especially suited for data that naturally lives in non-Euclidean spaces, such as hierarchical data, networks, and certain types of biological data.
If you use our work, please cite the Manify
paper:
@misc{chlenski2025manifypythonlibrarylearning,
title={Manify: A Python Library for Learning Non-Euclidean Representations},
author={Philippe Chlenski and Kaizhu Du and Dylan Satow and Itsik Pe'er},
year={2025},
eprint={2503.09576},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2503.09576},
}