Curvature Estimation¶
manify.curvature_estimation
¶
Methods for estimating curvature in metric spaces and graphs.
This module provides tools to estimate various curvature properties of metric spaces and graphs:
delta_hyperbolicity: Computes the Gromov delta-hyperbolicity, which measures how close a metric space is to a tree.greedy_method: Implements the greedy signature selection method from Tabaghi et al.sectional_curvature: Estimates the sectional curvature of a graph from its distance matrix.
greedy_signature_selection(candidate_components=((-1.0, 2), (0.0, 2), (1.0, 2)), max_components=3, pipeline=distortion_pipeline, verbose=False, **kwargs)
¶
Greedily estimates an optimal product manifold signature.
This implements the greedy signature selection algorithm that incrementally builds a product manifold by selecting components that best preserve distances. At each step, it chooses the manifold component that maximizes distortion reduction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in manify/curvature_estimation/greedy_method.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
delta_hyperbolicity
¶
δ-hyperbolicity computation for metric spaces.
The δ-hyperbolicity measures how close a metric space is to a tree. Smaller values indicate the space is more hyperbolic (tree-like).
delta_hyperbolicity(distance_matrix, samples=None, reference_idx=0, relative=True)
¶
Computes δ-hyperbolicity from a distance matrix.
For each triplet of points (x,y,z) and reference point w, computes: δ(x,y,z) = min((x,y)_w, (y,z)_w) - (x,z)_w
where (a,b)_w = ½(d(w,a) + d(w,b) - d(a,b)) is the Gromov product.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Note
For global statistics, call .max() or other aggregation functions on the result.
Source code in manify/curvature_estimation/delta_hyperbolicity.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |
greedy_method
¶
Greedy method for estimating mixed-curvature product manifold signatures.
This module implements the greedy signature selection approach described in Tabaghi, Pan, Chien, Peng & Milenkovic. "Linear Classifiers in Product Space Forms" (2021).
greedy_signature_selection(candidate_components=((-1.0, 2), (0.0, 2), (1.0, 2)), max_components=3, pipeline=distortion_pipeline, verbose=False, **kwargs)
¶
Greedily estimates an optimal product manifold signature.
This implements the greedy signature selection algorithm that incrementally builds a product manifold by selecting components that best preserve distances. At each step, it chooses the manifold component that maximizes distortion reduction.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Source code in manify/curvature_estimation/greedy_method.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
sectional_curvature
¶
Sectional curvature estimation for graphs.
This module implements the graph sectional curvature estimation from: Gu et al. "Learning mixed-curvature representations in product spaces." ICLR 2019.
Estimates local curvature at nodes using a discrete triangle comparison theorem.
sectional_curvature(adjacency_matrix, distance_matrix, samples=None, relative=True)
¶
Estimates sectional curvature of a graph.
Uses discrete triangle comparison theorem to estimate local curvature. Positive values indicate spherical-like regions, negative values indicate hyperbolic-like regions, zero indicates flat regions.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Note
For global statistics, call .mean() or other aggregation functions on the result.
Source code in manify/curvature_estimation/sectional_curvature.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |