oineus.diff.wasserstein_cost¶
- oineus.diff.wasserstein_cost(dgm_a, dgm_b, wasserstein_q=1.0, wasserstein_delta=0.05, ignore_inf_points=True, internal_p=inf)[source]¶
Differentiable Wasserstein cost between two persistence diagrams.
Returns
cost = sum_pair dist(p_a, p_b) ** wasserstein_qso thatWasserstein_q distance == cost ** (1 / wasserstein_q).- Parameters:
dgm_a (Tensor) –
(N, 2)tensor of (birth, death) points.dgm_b (Tensor) –
(M, 2)tensor of (birth, death) points.wasserstein_q (float) – Wasserstein power (default 1.0 → W_1).
wasserstein_delta (float) – Hera relative-error parameter (must be > 0).
ignore_inf_points (bool) – If True, drop essential (±inf) points before matching. If False, every essential family must have equal cardinalities on both sides; the matching pairs them by sorted-rank of the finite coordinate.
internal_p (float) – Ground metric in the (birth, death) plane.
infselects L_∞.
- Returns:
Scalar tensor with the cost. Gradients flow through every matched finite point on both sides (and through the finite coord of every matched essential). Diagonal projections are detached.
- Return type: