hamiltonian-nn  by greydanus

Research paper code for Hamiltonian Neural Networks

created 6 years ago
477 stars

Top 64.9% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This repository provides code for Hamiltonian Neural Networks (HNNs), a method for training neural networks that learn and respect physical conservation laws in an unsupervised manner. It's targeted at researchers and engineers working with physical systems who need models that generalize well and exhibit properties like time reversibility. The primary benefit is improved accuracy and generalization by incorporating physical inductive biases.

How It Works

HNNs leverage Hamiltonian mechanics by modeling system dynamics in a learned latent space. An autoencoder first maps pixel-space observations to a latent representation, which is then fed into the HNN. The HNN learns the system's time derivative in this latent space, aiming to preserve energy conservation. This approach allows for accurate simulation and prediction, even when energy is added to the system mid-simulation.

Quick Start & Requirements

  • Install: pip install -r requirements.txt
  • Prerequisites: Python 3, PyTorch, NumPy, OpenAI Gym, ImageIO, Scipy.
  • Usage: Run training scripts like python3 experiment-spring/train.py --verbose. Analysis notebooks are also provided.
  • Resources: Requires datasets of physical system observations.

Highlighted Details

  • Models learn and respect exact conservation laws.
  • Achieves faster training and better generalization than baseline NNs on several physics tasks.
  • Demonstrates perfect time reversibility.
  • Applicable to multi-body problems and pixel-based observations.

Maintenance & Community

The project is associated with Sam Greydanus, Misko Dzamba, and Jason Yosinski, authors of the cited paper. Further community engagement channels are not explicitly mentioned in the README.

Licensing & Compatibility

The repository does not explicitly state a license. Users should verify licensing for commercial or closed-source use.

Limitations & Caveats

The README does not specify a license, which may hinder commercial adoption. Performance on the "3 body problem" shows significant variance in both training and test loss, suggesting potential instability or sensitivity to hyperparameters for more complex systems.

Health Check
Last commit

4 years ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
10 stars in the last 90 days

Explore Similar Projects

Starred by Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake).

applied-ai by pytorch-labs

0.3%
289
Applied AI experiments and examples for PyTorch
created 2 years ago
updated 2 months ago
Feedback? Help us improve.