oineus.diff.sliced_wasserstein_distance

oineus.diff.sliced_wasserstein_distance(dgm1, dgm2, n_directions=100, ignore_inf_points=False)[source]

Sliced Wasserstein distance between two persistence diagrams.

This is the standard sliced Wasserstein where diagonal projections participate in gradients. When a point p from dgm1 is matched to diag_proj(q) from dgm2, both p and q receive gradients.

Parameters:
  • dgm1 – (N, 2) tensor of persistence diagram points (birth, death)

  • dgm2 – (M, 2) tensor of persistence diagram points (birth, death)

  • n_directions – Number of random projection directions

  • ignore_inf_points – If True, only consider finite points

Returns:

Scalar tensor with the sliced Wasserstein distance