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

WIP: adds lagrangian nn and simlple example #537

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

manyfeatures
Copy link

PR adds Lagrangian NN implementation (#352)
Screenshot from 2021-04-24 17-58-38

Evident drawbacks:

  • For Hessian and Jacobians all cross-derivatives are computed before extracting the useful ones
  • Only one-point data has been tested
  • Vectorization and batches are not tested
  • No GPU support
    One sample training loss function:
    image

More meaningful example is coming

src/lnn.jl Outdated Show resolved Hide resolved
src/lnn.jl Outdated Show resolved Hide resolved
src/lnn.jl Outdated Show resolved Hide resolved
@@ -0,0 +1,24 @@
# One point test
using Flux, ReverseDiff, LagrangianNN
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to test folder and included in runtests.jl

re = lnn.re
hess = x -> Zygote.hessian_reverse(x->sum(re(p)(x)), x) # we have to compute the whole hessian
hess = hess(x)[M+1:end, M+1:end] # takes only velocities
inv_hess = GenericLinearAlgebra.pinv(hess)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why pinv?

@manyfeatures manyfeatures changed the title adds lagrangian nn and simlple example WIP: adds lagrangian nn and simlple example May 31, 2021
@YichengDWu
Copy link
Contributor

Related to JuliaDiff/FiniteDiff.jl#147

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