Skip to content
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

Example: variational problems using autodiff #122

Merged
merged 7 commits into from
Aug 27, 2021
Merged

Example: variational problems using autodiff #122

merged 7 commits into from
Aug 27, 2021

Conversation

zsteve
Copy link
Member

@zsteve zsteve commented Aug 27, 2021

Added a new example notebook examples/variational demonstrating how to use the package to differentiate through the output of sinkhorn2 and approximate solutions to PDEs as Wasserstein gradient flows.

examples/variational/script.jl Outdated Show resolved Hide resolved
examples/variational/script.jl Outdated Show resolved Hide resolved
examples/variational/script.jl Outdated Show resolved Hide resolved
examples/variational/script.jl Outdated Show resolved Hide resolved
examples/variational/script.jl Outdated Show resolved Hide resolved
examples/variational/script.jl Outdated Show resolved Hide resolved
examples/variational/script.jl Outdated Show resolved Hide resolved
examples/variational/script.jl Outdated Show resolved Hide resolved
examples/variational/script.jl Outdated Show resolved Hide resolved
examples/variational/script.jl Outdated Show resolved Hide resolved
@coveralls
Copy link

coveralls commented Aug 27, 2021

Pull Request Test Coverage Report for Build 1173827433

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 97.654%

Totals Coverage Status
Change from base Build 1165287400: 0.0%
Covered Lines: 666
Relevant Lines: 682

💛 - Coveralls

@codecov-commenter
Copy link

codecov-commenter commented Aug 27, 2021

Codecov Report

Merging #122 (5061289) into master (ce8110c) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #122   +/-   ##
=======================================
  Coverage   97.65%   97.65%           
=======================================
  Files          13       13           
  Lines         682      682           
=======================================
  Hits          666      666           
  Misses         16       16           

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 ce8110c...5061289. Read the comment docs.

@zsteve zsteve merged commit d33f1cf into master Aug 27, 2021
@zsteve zsteve deleted the example_jko branch August 27, 2021 12:38
@davibarreira
Copy link
Member

davibarreira commented Aug 28, 2021

Hey @zsteve , what exactly is this optimization that you used to minimize the $\rho$ (the variational problem)? This is the only thing that it wasn't quite clear to me when reading the example. I mean, since $\rho$ is actually a distribution, how are you using gradient descent on it?

function step(ρ0, τ, ε, C, G)
    opt = optimize(
        u -> G(softmax(u), ρ0, τ, ε, C),
        ones(size(ρ0)),
        LBFGS(),
        Optim.Options(; iterations=50, g_tol=1e-6);
        autodiff=:forward,
    )
    return softmax(Optim.minimizer(opt))
end

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1173499718

Warning: 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

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 97.654%

Totals Coverage Status
Change from base Build 1165287400: 0.0%
Covered Lines: 666
Relevant Lines: 682

💛 - Coveralls

@coveralls
Copy link

coveralls commented Sep 25, 2024

Pull Request Test Coverage Report for Build 1173755911

Warning: 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

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 97.654%

Totals Coverage Status
Change from base Build 1165287400: 0.0%
Covered Lines: 666
Relevant Lines: 682

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants