att.topology¶
Persistent homology computation and topological summaries.
- class att.topology.PersistenceAnalyzer(max_dim=2, backend='ripser', use_witness=False, n_landmarks=500, metric='euclidean')[source]¶
Bases:
objectCompute persistent homology on point clouds.
- Parameters:
- fit_transform(cloud, subsample=None, seed=None, min_effective_dim=5)[source]¶
Compute persistence diagrams and derived representations.
- Parameters:
cloud ((n_points, dimension) point cloud)
subsample (if int, randomly select this many points first)
seed (random seed for subsampling)
min_effective_dim (int)
- Returns:
dict with diagrams, betti_curves, persistence_entropy,
bottleneck_norms, persistence_images, persistence_landscapes
- Return type:
- distance(other, metric='bottleneck')[source]¶
Compute distance between persistence diagrams.
- Parameters:
other (another PersistenceAnalyzer with computed diagrams)
metric ("bottleneck", "wasserstein_1", "wasserstein_2")
- Returns:
float
- Return type:
maximum distance across all dimensions
- to_image(resolution=50, sigma=0.1, birth_range=None, persistence_range=None)[source]¶
Convert diagrams to persistence images.
- Parameters:
resolution (int) – Grid size for the persistence image (resolution x resolution).
sigma (float) – Gaussian kernel bandwidth.
birth_range ((min, max) or None) – Explicit birth-axis range. If None, computed from data per diagram.
persistence_range ((min, max) or None) – Explicit persistence-axis range. If None, computed from data per diagram.
- Return type:
list of (resolution, resolution) arrays, one per homology dimension.
- exception att.topology.TopologyDimensionalityWarning[source]¶
Bases:
UserWarningIssued when point cloud effective rank is below minimum for stable PH.
- att.topology.knn_graph_laplacian(cloud, k=15, symmetrize='or')[source]¶
Build the graph Laplacian from a kNN adjacency graph.
- Parameters:
- Returns:
L – semi-definite.
- Return type:
(n, n) sparse CSR Laplacian (L = D - W), symmetric positive
- att.topology.spectral_distance_matrix(cloud, k=15, n_eigenvectors=None)[source]¶
Compute effective-resistance distance matrix from kNN graph Laplacian.
- The effective resistance between nodes i and j is:
R(i,j) = (e_i - e_j)^T L^+ (e_i - e_j)
which can be computed efficiently via the spectral decomposition of L.
- class att.topology.PersistenceAnalyzer(max_dim=2, backend='ripser', use_witness=False, n_landmarks=500, metric='euclidean')[source]¶
Bases:
objectCompute persistent homology on point clouds.
- Parameters:
- __init__(max_dim=2, backend='ripser', use_witness=False, n_landmarks=500, metric='euclidean')[source]¶
- fit_transform(cloud, subsample=None, seed=None, min_effective_dim=5)[source]¶
Compute persistence diagrams and derived representations.
- Parameters:
cloud ((n_points, dimension) point cloud)
subsample (if int, randomly select this many points first)
seed (random seed for subsampling)
min_effective_dim (int)
- Returns:
dict with diagrams, betti_curves, persistence_entropy,
bottleneck_norms, persistence_images, persistence_landscapes
- Return type:
- distance(other, metric='bottleneck')[source]¶
Compute distance between persistence diagrams.
- Parameters:
other (another PersistenceAnalyzer with computed diagrams)
metric ("bottleneck", "wasserstein_1", "wasserstein_2")
- Returns:
float
- Return type:
maximum distance across all dimensions
- to_image(resolution=50, sigma=0.1, birth_range=None, persistence_range=None)[source]¶
Convert diagrams to persistence images.
- Parameters:
resolution (int) – Grid size for the persistence image (resolution x resolution).
sigma (float) – Gaussian kernel bandwidth.
birth_range ((min, max) or None) – Explicit birth-axis range. If None, computed from data per diagram.
persistence_range ((min, max) or None) – Explicit persistence-axis range. If None, computed from data per diagram.
- Return type:
list of (resolution, resolution) arrays, one per homology dimension.