-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MRG] Extend unbalanced OT solvers for more flexibility #539
Merged
Conversation
This file contains 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
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #539 +/- ##
==========================================
+ Coverage 96.38% 96.46% +0.08%
==========================================
Files 67 67
Lines 14389 14490 +101
==========================================
+ Hits 13869 13978 +109
+ Misses 520 512 -8 |
rflamary
reviewed
Oct 26, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Huy for the big update that was needed. I have a few comments but it is looking good.
rflamary
changed the title
[WIP] Extend unbalanced OT solvers for more flexibility
[MRG] Extend unbalanced OT solvers for more flexibility
Oct 27, 2023
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
unbalanced.py
(except for barycenter), so that the argumentreg_m
can take either a scalar, or an indexable object of length 1 or 2.mm_unbalanced
method so that it can be used for both unregularized and regularized problems (previously supported unregularized only). Also, fix an implementation error of matrixtest_unbalanced.py
.Motivation and context / Related issue
sinkhorn_unbalanced
andlbfgsb_unbalanced
methods only allow forreg_m
to be a scalar, thus impose the same penalization on both marginals.mm_unbalanced
method has the same limitation and restrict only to the unregularized problem._get_loss_unbalanced
method uses incorrect formula of KL divergence, since we are working with unnormalized measures. As a result, the calculation of the gradient is also incorrect.This PR fixes all of these issues. Moreover, as a byproduct, the new version of
sinkhorn_unbalanced
method also allows to solve the entropic balanced and semi-relaxed problems.How has this been tested (if it applies)
Tested when
reg_m
is a scalar, indexable objects of length 1 and 2 (tuple, list, array/tensor).PR checklist