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. More...  
double  compute_scalar_product (const Sliced_Wasserstein &second) const 
Evaluation of the kernel on a pair of diagrams. More...  
double  distance (const Sliced_Wasserstein &second) const 
Evaluation of the distance between images of diagrams in the Hilbert space of the kernel. More...  
A class implementing the Sliced Wasserstein kernel.
In this class, we compute infinitedimensional representations of persistence diagrams by using the Sliced Wasserstein kernel (see Kernels on persistence diagrams for more details on kernels). We recall that infinitedimensional 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 Gaussianlike 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 1norm 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 [16] .

inline 
Sliced Wasserstein kernel constructor. , Real_valued_topological_data, Topological_data_with_scalar_product.
[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. 

inline 
Evaluation of the kernel on a pair of diagrams.
[in]  second  other instance of class Sliced_Wasserstein. 

inline 
Evaluation of the distance between images of diagrams in the Hilbert space of the kernel.
[in]  second  other instance of class Sliced_Wasserstein. 