Git Product home page Git Product logo

weakformghnn's Introduction

Weak Form Generalized Hamiltonian Learning

This library provides a PyTorch implementation for performing Weak Form Generalized Hamiltonian Learning. This code accompanies this Neurips2020 paper [1] by Kevin L. Course, Trefor W. Evans, and Prasanth B. Nair.

As everything is written in PyTorch, all algorithms provide full GPU support.


Lorenz63 gen hamiltonian neural net

Please cite our paper if you find this code useful in your research. The bibliographic information for the paper is,

@inproceedings{course_wfghnn_2020,
 author = {Course, Kevin and Evans, Trefor and Nair, Prasanth},
 booktitle = {Advances in Neural Information Processing Systems},
 editor = {H. Larochelle and M. Ranzato and R. Hadsell and M. F. Balcan and H. Lin},
 pages = {18716--18726},
 publisher = {Curran Associates, Inc.},
 title = {Weak Form Generalized Hamiltonian Learning},
 url = {https://proceedings.neurips.cc/paper/2020/file/d93c96e6a23fff65b91b900aaa541998-Paper.pdf},
 volume = {33},
 year = {2020}
}

Our experiments make heavy use of Chen et. al's torchdiffeq package [2] and we use the rectified Huber unit from Kolter et. al [3].


Installation

pip install git+https://github.com/coursekevin/weakformghnn#egg=weakformghnn

Library Overview

This library provides three main components:

  • GHNN class: The class provides a convenient interface for specifying strong priors on the form of the generalized Hamiltonian. This module inherits from the torch nn.Module class. This allows GHNNs to be trained in the usual ways one can train a model for a continuous time ODE (ie. see [1,2]). See the ghnn_tutorial for an example of how to use this class in context.

  • GHNNwHPrior class: This class has a similar structure to the main GHNN class except it should only be used when the generalized Hamiltonian is known. It can be trained in the same way as a standard GHNN.

  • weak_form_loss: Use this loss function to perform "weak form regression" with any model for a continuous time ODE. See the weakform_tutorial for an example.

Example pendulum training

References

[1] Kevin L. Course, Trefor W. Evans, Prasanth B. Nair. "Weak Form Generalized Hamiltonian Learning." Advances in Neural Information Processing Systems. 2020.

[2] Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, David Duvenaud. "Neural Ordinary Differential Equations." Advances in Neural Information Processing Systems. 2018.

[3] J. Z. Kolter and G. Manek. “Learning Stable Deep Dynamics Models”. In: Advances in Neural Information Processing Systems 32. Ed. by H. Wallach, H. Larochelle, A. Beygelzimer, F. d. Alché-Buc, E. Fox, and R. Garnett. Curran Associates, Inc., 2019, pp. 11126–11134.

weakformghnn's People

Contributors

coursekevin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

weakformghnn's Issues

Can't install library using Anaconda.

Hi. I am currently unable to install the weakformghnn library through anaconda prompt. When running pip install git+https://github.com/coursekevin/weakformghnn#egg=weakformghnn i get the error:

Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "C:\Users\XXX\AppData\Local\Temp\pip-install-9nslk2i5\weakformghnn_2dd4a9862dad48e1ab2067e6704cd9ec\setup.py", line 4, in
long_description = fh.read()
File "C:\Users\XXX\anaconda3\envs\GithubEnv\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 2923: character maps to
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

How can this be solved? Is there any other way to install the library in a compatible way with anaconda?

Thank you in advance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.