distances {phutil} | R Documentation |
Distances between two persistence diagrams
Description
This collection of functions computes the distance between two persistence diagrams of the same homology dimension. The diagrams must be represented as 2-column matrices. The first column of the matrix contains the birth times and the second column contains the death times of the points.
Usage
bottleneck_distance(
x,
y,
tol = sqrt(.Machine$double.eps),
validate = TRUE,
dimension = 0L
)
wasserstein_distance(
x,
y,
tol = sqrt(.Machine$double.eps),
p = 1,
validate = TRUE,
dimension = 0L
)
kantorovich_distance(
x,
y,
tol = sqrt(.Machine$double.eps),
p = 1,
validate = TRUE,
dimension = 0L
)
Arguments
x |
Either a matrix of shape |
y |
Either a matrix of shape |
tol |
A numeric value specifying the relative error. Defaults to
|
validate |
A boolean value specifying whether to validate the input
persistence diagrams. Defaults to |
dimension |
An integer value specifying the homology dimension for which
to compute the distance. Defaults to |
p |
A numeric value specifying the power for the Wasserstein distance.
Defaults to |
Details
A matching \varphi : D_1 \to D_2
between persistence diagrams is a
bijection of multisets, where both diagrams are assumed to have all points on
the diagonal with infinite multiplicity. The p
-Wasserstein distance
between D_1
and D_2
is defined as the infimum over all matchings
of the expression
W_p(D_1,D_2) = \inf_{\varphi: D_1 \to D_2}
\left( \sum_{x \in D_1}{\lVert x - \varphi(x) \rVert^p}
\right)^{\frac{1}{p}}
that can be thought of as the Minkowski distance between the diagrams viewed
as vectors on the shared coordinates defined by the matching \varphi
.
The norm \lVert \cdot \rVert
can be arbitrary; as implemented here, it
is the infinity norm \lVert (x_1,x_2) \rVert_\infty = \max(x_1,x_2)
. In
the limit p \to \infty
, the Wasserstein distance becomes the
bottleneck distance:
B(D_1,D_2) = \inf_{\varphi: D_1 \to D_2}
\sup_{x \in D_1}{\lVert x - \varphi(x) \rVert}.
The Wasserstein metric is also called the Kantorovich metric in recognition of the originator of the metric.
Value
A numeric value storing either the Bottleneck or the Wasserstein distance between the two persistence diagrams.
See Also
Examples
bottleneck_distance(
persistence_sample[[1]]$pairs[[1]],
persistence_sample[[2]]$pairs[[1]]
)
bottleneck_distance(
persistence_sample[[1]],
persistence_sample[[2]]
)
wasserstein_distance(
persistence_sample[[1]]$pairs[[1]],
persistence_sample[[2]]$pairs[[1]]
)
wasserstein_distance(
persistence_sample[[1]],
persistence_sample[[2]]
)