Loading...
Searching...
No Matches
Gudhi::Persistence_representations::Sliced_Wasserstein Class Reference
Persistence representations

A class implementing the Sliced Wasserstein kernel. More...

`#include <gudhi/Sliced_Wasserstein.h>`

## Public Member Functions

| Sliced_Wasserstein (const Persistence_diagram &_diagram, double _sigma=1.0, int _approx=10)
| Sliced Wasserstein kernel constructor. , Real_valued_topological_data, Topological_data_with_scalar_product.
double | compute_scalar_product (const Sliced_Wasserstein &second) const
| Evaluation of the kernel on a pair of diagrams.
double | distance (const Sliced_Wasserstein &second) const
| Evaluation of the distance between images of diagrams in the Hilbert space of the kernel.

## Detailed Description

A class implementing the Sliced Wasserstein kernel.

In this class, we compute infinite-dimensional representations of persistence diagrams by using the Sliced Wasserstein kernel (see Kernels on persistence diagrams for more details on kernels). We recall that infinite-dimensional representations are defined implicitly, so only scalar products and distances are available for the representations defined in this class. The Sliced Wasserstein kernel is defined as a Gaussian-like kernel between persistence diagrams, where the distance used for comparison is the Sliced Wasserstein distance \(SW\) between persistence diagrams, defined as the integral of the 1-norm between the sorted projections of the diagrams onto all lines passing through the origin:

\( SW(D_1,D_2)=\int_{\theta\in\mathbb{S}}\,\|\pi_\theta(D_1\cup\pi_\Delta(D_2))-\pi_\theta(D_2\cup\pi_\Delta(D_1))\ |_1{\rm d}\theta\),

where \(\pi_\theta\) is the projection onto the line defined with angle \(\theta\) in the unit circle \(\mathbb{S}\), and \(\pi_\Delta\) is the projection onto the diagonal. Assuming that the diagrams are in general position (i.e. there is no collinear triple), the integral can be computed exactly in \(O(n^2{\rm log}(n))\) time, where \(n\) is the number of points in the diagrams. We provide two approximations of the integral: one in which we slightly perturb the diagram points so that they are in general position, and another in which we approximate the integral by sampling \(N\) lines in the circle in \(O(Nn{\rm log}(n))\) time. The Sliced Wasserstein Kernel is then computed as:

\( k(D_1,D_2) = {\rm exp}\left(-\frac{SW(D_1,D_2)}{2\sigma^2}\right).\)

The first method is usually much more accurate but also much slower. For more details, please see [pmlr-v70-carriere17a] .

Examples
  sliced_wasserstein.cpp.

## Constructor & Destructor Documentation

## Sliced_Wasserstein()

Gudhi::Persistence_representations::Sliced_Wasserstein::Sliced_Wasserstein | ( | const Persistence_diagram & | _diagram,
|  | double | _sigma = 1.0,
|  | int | _approx = 10 )

inline

Sliced Wasserstein kernel constructor. , Real_valued_topological_data, Topological_data_with_scalar_product.

Parameters

  [in] | _diagram | persistence diagram.
  [in] | _sigma | bandwidth parameter.
  [in] | _approx | number of directions used to approximate the integral in the Sliced Wasserstein distance, set to -1 for random perturbation. If positive, then projections of the diagram points on all directions are stored in memory to reduce computation time.

## Member Function Documentation

## compute_scalar_product()

double Gudhi::Persistence_representations::Sliced_Wasserstein::compute_scalar_product | ( | const Sliced_Wasserstein & | second | ) | const

inline

Evaluation of the kernel on a pair of diagrams.

Precondition
  approx and sigma attributes need to be the same for both instances.

Parameters

  [in] | second | other instance of class Sliced_Wasserstein.

Examples
  sliced_wasserstein.cpp.

## distance()

double Gudhi::Persistence_representations::Sliced_Wasserstein::distance | ( | const Sliced_Wasserstein & | second | ) | const

inline

Evaluation of the distance between images of diagrams in the Hilbert space of the kernel.

Precondition
  approx and sigma attributes need to be the same for both instances.

Parameters

  [in] | second | other instance of class Sliced_Wasserstein.

Examples
  sliced_wasserstein.cpp.

The documentation for this class was generated from the following file:

- include/gudhi/Sliced_Wasserstein.h