|
def | __init__ (self, order=1, internal_p=np.inf, mode="hera", delta=0.01, n_jobs=None) |
|
def | fit (self, X, y=None) |
|
def | transform (self, X) |
|
def | __call__ (self, diag1, diag2) |
|
This is a class for computing the Wasserstein distance matrix from a list of persistence diagrams.
◆ __init__()
def gudhi.representations.metrics.WassersteinDistance.__init__ |
( |
|
self, |
|
|
|
order = 1 , |
|
|
|
internal_p = np.inf , |
|
|
|
mode = "hera" , |
|
|
|
delta = 0.01 , |
|
|
|
n_jobs = None |
|
) |
| |
Constructor for the WassersteinDistance class.
Parameters:
order (int): exponent for Wasserstein, default value is 1., see :func:`gudhi.wasserstein.wasserstein_distance`.
internal_p (int): ground metric on the (upper-half) plane (i.e. norm l_p in R^2), default value is `np.inf`, see :func:`gudhi.wasserstein.wasserstein_distance`.
mode (str): method for computing Wasserstein distance. Either "pot" or "hera". Default set to "hera".
delta (float): relative error 1+delta. Used only if mode == "hera".
n_jobs (int): number of jobs to use for the computation. See :func:`pairwise_persistence_diagram_distances` for details.
◆ __call__()
def gudhi.representations.metrics.WassersteinDistance.__call__ |
( |
|
self, |
|
|
|
diag1, |
|
|
|
diag2 |
|
) |
| |
Apply WassersteinDistance on a single pair of persistence diagrams and outputs the result.
Parameters:
diag1 (n x 2 numpy array): first input persistence diagram.
diag2 (n x 2 numpy array): second input persistence diagram.
Returns:
float: Wasserstein distance.
◆ fit()
def gudhi.representations.metrics.WassersteinDistance.fit |
( |
|
self, |
|
|
|
X, |
|
|
|
y = None |
|
) |
| |
Fit the WassersteinDistance class on a list of persistence diagrams: persistence diagrams are stored in a numpy array called **diagrams**.
Parameters:
X (list of n x 2 numpy arrays): input persistence diagrams.
y (n x 1 array): persistence diagram labels (unused).
◆ transform()
def gudhi.representations.metrics.WassersteinDistance.transform |
( |
|
self, |
|
|
|
X |
|
) |
| |
Compute all Wasserstein distances between the persistence diagrams that were stored after calling the fit() method, and a given list of (possibly different) persistence diagrams.
Parameters:
X (list of n x 2 numpy arrays): input persistence diagrams.
Returns:
numpy array of shape (number of diagrams in **diagrams**) x (number of diagrams in X): matrix of pairwise Wasserstein distances.
The documentation for this class was generated from the following file:
- src/python/gudhi/representations/metrics.py