[MRG] Linear Circular OT by clbonet · Pull Request #736 · PythonOT/POT
Types of changes
This PR aims to add the Linear Circular OT distance (with uniform measure on the circle as reference measure) introduced in LCOT: Linear Circular Optimal Transport
and its sliced counterpart introduced in Linear Spherical Sliced Optimal Transport: A Fast Metric for Comparing Spherical Data
.
Changes:
- Added the
ot.solver_1d.linear_circular_embeddingandot.solver_1d.linear_circular_otfunctions to compute the Linear Circular OT distance. - Added the
ot.sliced.linear_sliced_wasserstein_spherefunction to compute its sliced counterpart. - Refactored the code for the spherical sliced distances, adding the functions
ot.sliced.get_projections_sphereandot.sliced.projection_sphere_to_circle. - Added tests for these functions in
test/test_1d_solverandtest/test_sliced. - Added the Linear Circular OT distance in the example
plot_compute_wasserstein_circle.py - Modified the default behavior of
ot.wasserstein_circleto always useot.solver_1d.binary_search_circlefor any p, which seems to give better results even for p=1 (as discussed in Issue Wasserstein Circle distance doesn't seem correct? #738). - Improved the visualization of the sphere in the example
plot_ssw_unif_torch.py.
Motivation and context / Related issue
The Linear Circular OT distance with uniform measure on the circle is very fast to compute, as the OT maps can be computed in closed-forms. It is thus faster to compute than the true wasserstein distance on the circle.
How has this been tested (if it applies)
I added tests of these functions in test/test_1d_solver and test/test_sliced.
PR checklist
- I have read the CONTRIBUTING document.
- The documentation is up-to-date with the changes I made (check build artifacts).
- All tests passed, and additional code has been covered with new tests.
- I have added the PR and Issue fix to the RELEASES.md file.