2-Wasserstein (Engquist–Froese / Yang) misfit¶
Definition¶
For two 1-D densities \(f, g\) with CDFs \(F, G\),
We sample \(z\) uniformly on \((0,1)\) (n_quantiles knots, default 256),
linearly interpolate the inverse CDFs from the cumulative sums of the
two trace densities, and Monte-Carlo the integral. The loss returned is
\(\tfrac12 W_2^2\) following the FWI convention of Yang, Engquist, Sun
& Hamfeldt (2018).
Signed traces are first mapped to non-negative densities via the same
positive argument as the NIM and W1 losses.
Key property¶
For a translated Gaussian density of shift \(\Delta t\),
i.e. \(\tfrac12 W_2^2 = \tfrac12 (\Delta t)^2\) which is quadratic and
convex in the shift. This is the cycle-skipping cure proposed by
Engquist & Froese (2014). Tested in
test_w2_squared_equals_shift_squared_for_translated_gaussian.
API¶
from sweep_loss import Wasserstein2Loss, w2_loss
Wasserstein2Loss(positive="square", dt=1e-3, n_quantiles=256)(syn, obs)
Tests¶
tests/test_w2.py checks:
- zero for identical signals across positive transforms,
- analytic identity \(\tfrac12 W_2^2 = \tfrac12(\Delta t)^2\) to relative 5% on translated Gaussians,
- monotone growth with shift,
- monotone across a range where L2 cycle-skips,
- gradients flow,
- parameter validation.
References¶
- Engquist, B. & Froese, B. D. (2014). Application of the Wasserstein metric to seismic signals. Commun. Math. Sci. 12 (5), 979-988. doi:10.4310/CMS.2014.v12.n5.a7
- Engquist, B., Froese, B. D. & Yang, Y. (2016). Optimal transport for seismic full waveform inversion. Commun. Math. Sci. 14 (8), 2309-2330. doi:10.4310/CMS.2016.v14.n8.a9
- Yang, Y., Engquist, B., Sun, J. & Hamfeldt, B. F. (2018). Application of optimal transport and the quadratic Wasserstein metric to full-waveform inversion. Geophysics 83 (1), R43-R62. doi:10.1190/geo2016-0663.1