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 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:
,
where is the projection onto the line defined with angle in the unit circle , and 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 time, where 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 lines in the circle in time. The Sliced Wasserstein Kernel is then computed as:
The first method is usually much more accurate but also much slower. For more details, please see [16] .
- Examples
- sliced_wasserstein.cpp.