[MRG] Add QSW sampling for sliced Wasserstein - #838
Open
Samuel-Vangu wants to merge 3 commits into
Open
Conversation
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Types of changes
Motivation and context / Related issue
Closes #835
This PR adds Quasi-Monte Carlo (QMC) sampling of projection directions to the Sliced Wasserstein module.
Currently,
sliced_wasserstein_distancesamples projection directions uniformly at random, corresponding to standard Monte Carlo sampling. This PR adds two alternatives based on the generalized spiral point construction described in [Nguyen, Bariletto & Ho (2024)](https://arxiv.org/abs/2309.11713):sampling_slices="qsw": deterministic Quasi-Sliced Wasserstein (QSW) projection directions.sampling_slices="rqsw": Randomized QSW (RQSW), obtained by applying a random rotation to the deterministic spiral point set.The new sampling methods are currently limited to 3D, while the existing
"uniform"sampling remains the default.The implementation also exposes
get_projections_spiraland updates the documentation, README references, release notes, and adds a 3D example.How has this been tested (if it applies)
The changes have been tested with:
pre-commit run --all-files— all checks pass.pytest test/sliced/test_sliced_distances.py— 62 tests passed.Added tests covering:
PR checklist