Movatterモバイル変換


[0]ホーム

URL:


Skip to contents

Distances between two persistence diagrams

Source:R/distances.R
distances.Rd

This collection of functions computes the distance between two persistencediagrams of the same homology dimension. The diagrams must be represented as2-column matrices. The first column of the matrix contains the birth timesand 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 \(n \times 2\) or an object of classpersistence specifying the first persistence diagram.

y

Either a matrix of shape \(m \times 2\) or an object of classpersistence specifying the second persistence diagram.

tol

A numeric value specifying the relative error. Defaults tosqrt(.Machine$double.eps). For the Bottleneck distance, it can be set to0.0 in which case the exact Bottleneck distance is computed, while anapproximate Bottleneck distance is computed iftol > 0.0. For theWasserstein distance, it must be strictly positive.

validate

A boolean value specifying whether to validate the inputpersistence diagrams. Defaults toTRUE. IfFALSE, the function will notcheck if the input persistence diagrams are valid. This can be useful forperformance reasons, but it is recommended to keep itTRUE for safety.

dimension

An integer value specifying the homology dimension for whichto compute the distance. Defaults to0L. This is only used ifx andyare objects of classpersistence.

p

A numeric value specifying the power for the Wasserstein distance.Defaults to1.0.

Value

A numeric value storing either the Bottleneck or the Wassersteindistance between the two persistence diagrams.

Details

A matching \(\varphi : D_1 \to D_2\) between persistence diagrams is abijection of multisets, where both diagrams are assumed to have all points onthe diagonal with infinite multiplicity. The\(p\)-Wasserstein distancebetween \(D_1\) and \(D_2\) is defined as the infimum over all matchingsof 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 viewedas vectors on the shared coordinates defined by the matching \(\varphi\).The norm \(\lVert \cdot \rVert\) can be arbitrary; as implemented here, itis the infinity norm \(\lVert (x_1,x_2) \rVert_\infty = \max(x_1,x_2)\). Inthe limit \(p \to \infty\), the Wasserstein distance becomes thebottleneck 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 recognitionof the originator of the metric.

See also

the Hera C++ library

Examples

bottleneck_distance(persistence_sample[[1]]$pairs[[1]],persistence_sample[[2]]$pairs[[1]])#> [1] 0.06197453bottleneck_distance(persistence_sample[[1]],persistence_sample[[2]])#> [1] 0.06197453wasserstein_distance(persistence_sample[[1]]$pairs[[1]],persistence_sample[[2]]$pairs[[1]])#> [1] 1.53403wasserstein_distance(persistence_sample[[1]],persistence_sample[[2]])#> [1] 1.53403

[8]ページ先頭

©2009-2026 Movatter.jp