-
Notifications
You must be signed in to change notification settings - Fork 9
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
add davibarreira's sinkhorn_divergence with some modifications #145
Conversation
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.
Nice, I wanted to update the PR this week but since I am a bit busy I'm happy that you took it up.
I have two major suggestions/requests though:
- I think we should allow both with and without regularization. POT includes the regularization as well as Feydy et al whereas Genevay et al didn't it seems.
- Probably we don't want to use standard Sinkhorn algorithm for the symmetric cases but instead the fixed point iterations in Feydy et al which apparently converge much faster.
Pull Request Test Coverage Report for Build 1229692504Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Codecov Report
@@ Coverage Diff @@
## master #145 +/- ##
==========================================
- Coverage 94.42% 85.27% -9.15%
==========================================
Files 12 14 +2
Lines 538 618 +80
==========================================
+ Hits 508 527 +19
- Misses 30 91 +61
Continue to review full report at Codecov.
|
Thanks, @zsteve, for updating the PR. Why did you remove the use of |
@devmotion what is this fixed points iterations? If I remember correctly, the paper of Feydy used Sinkhorn with fixed number of iterations. Is this what you are referring to? |
No, I am not referring to fixed number of iterations. They use a fixed point iteration for the symmetric case that is different from the standard Sinkhorn algorithm and exploits the additional structure of the problem. |
I think that was either done earlier (not exactly sure when? or possibly never merged?). For the time being perhaps best to keep as-is (specify vectors of weights, and for empirical measures the locations are encoded in the cost matrix). More than happy to reintroduce |
My bad, I think the implementation was |
|
I'm reading the code again, it has been quite some time. But for now, the way you coded seems fine. I can then submit another PR later if that's the case. |
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.
I think the only issue I found was with the regularization
, which seems that it's not been used.
Ok, I think I've worked out the update for the symmetric Sinkhorn (Eq. 25 of Feydy et al.), but in the variables
where |
yes, this one: http://proceedings.mlr.press/v89/feydy19a/feydy19a.pdf |
I think or where |
Agree with not exporting. In terms of the fixed point iteration, the current |
I've implemented The scheme derived in Feydy et al. uses a reference measure Where
where Another thing that I notice is that
When |
This is now addressed by the
This is now addressed by the |
Co-authored-by: David Widmann <[email protected]>
Co-authored-by: David Widmann <[email protected]>
…Transport/OptimalTransport.jl into sinkhorn_divergence
Co-authored-by: David Widmann <[email protected]>
Co-authored-by: David Widmann <[email protected]>
Co-authored-by: David Widmann <[email protected]>
Co-authored-by: David Widmann <[email protected]>
Co-authored-by: David Widmann <[email protected]>
Co-authored-by: David Widmann <[email protected]>
If everything looks good so far, will bump the version and merge once I get a chance.
I'll look into it in the next few days since I'm a little busy rn, but wondering if there's an easy fix. |
I think coveralls was down for maintenance. |
This PR adds
sinkhorn_divergence
due to @davibarreira in PR #92, except I have removed the use ofFiniteDiscreteMeasure
andDiscreteNonParametric
, etc. For now the implementation takes measures as vectors of weights, and precomputed cost matrices as supplied. A future PR could implement wrappers that take generic distributions as inputs.Notably, in the case where the support is fixed and there is a common cost matrix between source and target measures (as is the case on a fixed discrete domain),
sinkhorn_divergence
now takes advantage of the batched Sinkhorn computation.