Closed zsteve closed 2 years ago
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.
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
src/utils.jl | 0 | 5 | 0.0% | ||
src/dual/entropic_dual.jl | 0 | 21 | 0.0% | ||
<!-- | Total: | 0 | 26 | 0.0% | --> |
Totals | |
---|---|
Change from base Build 1223996798: | -4.8% |
Covered Lines: | 508 |
Relevant Lines: | 538 |
Merging #129 (7403b37) into master (f961027) will decrease coverage by
4.79%
. The diff coverage is0.00%
.
@@ Coverage Diff @@
## master #129 +/- ##
==========================================
- Coverage 99.21% 94.42% -4.80%
==========================================
Files 11 12 +1
Lines 512 538 +26
==========================================
Hits 508 508
- Misses 4 30 +26
Impacted Files | Coverage Δ | |
---|---|---|
src/dual/entropic_dual.jl | 0.00% <0.00%> (ø) |
|
src/utils.jl | 88.63% <0.00%> (-11.37%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update f961027...7403b37. Read the comment docs.
Let me know if anything further is needed for this PR!
Regarding the function names, I guess "ot_entropic" could be shortened to "ot_ent". _grad
could be replaced with a ∇
somewhere, but I think it would be good to continue the convention of avoiding unicode function names. In any case, these functions introduced are more "advanced" functionality, so perhaps longer function names is not so bad?
Merging since there don't seem to be additional comments.
This PR adds a submodule
Dual
that provides the duals of the smoothed Wasserstein loss and their gradients (so far only entropy-regularised, but could expand to L2 or group-sparse regularisations, see https://arxiv.org/abs/1710.06276).This kind of stuff is more geared towards variational problem use cases where OT is used as part of a loss function, rather than to 'statically' measure distances between prescribed distributions.
As an illustration of how dual approaches can be practically useful, the JKO example is updated with code that solves the dual problem (and this is much faster than using the primal approach of autodifferentiating
sinkhorn
).An additional example implementing Wasserstein-NMF as described in Rolet et al. (https://proceedings.mlr.press/v51/rolet16.pdf) is provided, and this demonstrates uses of the
Dual
submodule.P.S. apologies for the commits trying to get CIs to pass -- just figured out to set JULIA_LOAD_PATH="@" in order to prevent usage of packages from outside the active Julia environment!