This repository contains the code for a tutorial on Physics Informed Machine Learning (PIML) and Neural Networks.
This is strongly inspired by famous Ben Moseley post and demonstrates how to incorporate physical laws into machine learning models to improve predictions and interpretability.
.
├── .env.template
├── .gitignore
├── .python-version
├── pyproject.toml
├── README.md
├── uv.lock
├── notebooks/
│ └── 0 Inertial Oscillator.ipynb
└── src/
├── models.py
├── utils.py
└── physics/
└── inertial_oscillator.pynotebooks/– Jupyter notebooks demonstrating tutorial examples.src/models.py– Neural network models.src/utils.py– Utility functions.src/physics/– Physics-informed functions for modeling systems (e.g., inertial oscillator)..env.template– Template for environment variables.pyproject.toml– Project dependencies and configurations.uv.lock– Locked dependencies file for reproducibility.
git clone https://github.com/g-pa/piml-tutorial.git
cd piml-tutorialThis project uses Python with uv as the dependency manager. If you don’t have uv installed, you can install it following the official documentation.
Then you can install all the dependencies running the following command within the cloned repository:
uv syncThis command will:
- Read the project's dependency specifications
- Create a virtual environment (if one doesn't exist)
- Install all required packages with their correct versions
- Copy the template
.env.templateto.env - Modify
.envaccordingly to include all the custom paths needed
source .venv/bin/activate.venv\Scripts\activateRun the notebooks in notebooks directory to explore Physics Informed Machine Learning examples.