2.4.2. Distances
This module provides algorithms to compute pairwise distances between persistence diagrams. The bottleneck distance and wasserstein distance are available.
- teaspoon.TDA.Distance.bottleneckDist(pts0: ndarray, pts1: ndarray, matching=True, plot=True)[source]
- Compute the bottleneck distance between the diagrams pts0, pts1 using the persim package: https://persim.scikit-tda.org/en/latest/index.html - Parameters:
- pts0 (array of shape (n_top_features, 2)) – The first persistence diagram 
- pts1 (array of shape (n_top_features, 2)) – The second persistence diagram 
- matching (boolean, True returns matched array) 
- plot (boolean, True provides plot of matching points. Matching must be true for plot to return.) 
 
- Returns:
- distance – The bottleneck distance between diagrams - pts0and- pts1
- Return type:
- float 
 
- teaspoon.TDA.Distance.wassersteinDist(pts0: ndarray, pts1: ndarray, p: int = 2, q: int = 2, y_axis: AnyStr = 'death') float[source]
- Compute the Persistant p-Wasserstein distance between the diagrams pts0, pts1 using optimal transport. - Parameters:
- pts0 (array of shape (n_top_features, 2)) – The first persistence diagram 
- pts1 (array of shape (n_top_features, 2)) – The second persistence diagram 
- y_axis (optional, default="death") – - What the y-axis of the diagram represents. Should be one of - "lifetime"
- "death"
 
- p (int, optional (default=2)) – The p in the p-Wasserstein distance to compute 
- q (1, 2 or np.inf, optional (default = 2)) – The q for the internal distance between the points, L_q. Uses L_infty (Chebyshev) distance if q = np.inf. Currently not implemented for other q. 
 
- Returns:
- distance – The p-Wasserstein distance between diagrams - pts0and- pts1
- Return type:
- float 
 
Further information can be found in the Distance Notebook.