hamiltonian-nn  by greydanus

Research paper code for Hamiltonian Neural Networks

Created 6 years ago
481 stars

Top 63.7% on SourcePulse

GitHubView on GitHub
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
2 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.