Skip to content

[MRG]Add UnifOrtho sampling of slicing directions for Sliced Wasserstein - #853

Open
Samuel-Vangu wants to merge 4 commits into
PythonOT:masterfrom
Samuel-Vangu:feature/add-uniortho-sampling
Open

Samuel-Vangu wants to merge 4 commits into
PythonOT:masterfrom
Samuel-Vangu:feature/add-uniortho-sampling

Conversation

@Samuel-Vangu

Copy link
Copy Markdown
Contributor

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Documentation (added or improved documentation for existing code)

Motivation and context / Related issue

The Sliced Wasserstein distance only supports a low-discrepancy sampling
alternative to plain Monte Carlo (QSW/RQSW, PR #838) for dim == 3. This
leaves no principled alternative in higher dimension, where variance
reduction matters most.

Adds UnifOrtho sampling: independent blocks of mutually orthogonal
directions, drawn from the Haar measure on O(dim), defined for any
dim and recommended specifically for large dimension by a recent
numerical and theoretical study. Reuses the existing get_random_rotations
directly, requiring no new randomization primitive.

Closes #850 .

How has this been tested (if it applies)

  • New unit tests covering: unit-norm output, exact mutual orthogonality
    within a block, correctness for arbitrary dimensions (including
    non-multiples of dim), seed reproducibility, cross-backend consistency
    (NumPy, PyTorch, JAX, TensorFlow), and reduced approximation error
    compared to uniform sampling in high dimension against a closed-form
    reference distance.
  • Full existing test suite re-run to confirm no regression.
  • New gallery example (plot_uniortho.py) demonstrating both the
    orthogonal block structure and the convergence gain in high dimension.

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.

@Samuel-Vangu

Copy link
Copy Markdown
Contributor Author

Hi @rflamary @clbonet,

this one's ready for review whenever you have time.
Not a big PR -- I've essentially reused existing code
(get_random_rotations) to add UnifOrtho sampling.

@codecov

codecov Bot commented Sep 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.85%. Comparing base (6372a66) to head (20a01a6).

Additional details and impacted files
@@           Coverage Diff            @@
##           master     #853    +/-   ##
========================================
  Coverage   96.85%   96.85%            
========================================
  Files         128      128            
  Lines       26160    26268   +108     
========================================
+ Hits        25337    25443   +106     
- Misses        823      825     +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add UnifOrtho sampling of slicing directions for Sliced Wasserstein

2 participants