WIP: Add normalize parameter to sliced_wasserstein_distance#808
Open
Harguna wants to merge 1 commit intoPythonOT:masterfrom
Open
WIP: Add normalize parameter to sliced_wasserstein_distance#808Harguna wants to merge 1 commit intoPythonOT:masterfrom
Harguna wants to merge 1 commit intoPythonOT:masterfrom
Conversation
Collaborator
|
Thanks for this PR, we are a bit busy at te moement and will have more time to give some feedback after the neurips deadline in two weeks. |
Author
|
Sounds good, best of luck with the NeurIPS. |
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
Addresses #807.
Sliced Wasserstein Distance is sensitive to feature scale: features with larger numerical ranges dominate the random projections, drowning out meaningful differences in smaller-scale features. Users often don't realize this is happening and, when they do, the manual fix (preprocessing inputs with a scaler) is verbose and easy to get wrong — fitting each distribution independently silently corrupts the distance.
This PR adds optional
normalizeandnormalize_modeparameters tosliced_wasserstein_distanceandmax_sliced_wasserstein_distanceto handle this cleanly inside the function. Default behavior (normalize=None) is unchanged, so the change is fully backward-compatible.This is a
[WIP]skeleton PR - it establishes the API surface, signatures, docstrings, and a helper function so the design can be reviewed before the full implementation lands. The actual normalization math, edge case handling, behavioral tests, and example script will follow in subsequent commits on this same branch.How has this been tested (if it applies)
In this skeleton:
test/test_sliced.pytest suite continues to pass (verifies the new keyword parameters didn't break anything).pre-commit run --all-filespasses locally.Tests related to the new feature will be added with the full implementation in the subsequent commits.
PR checklist