tree: c2e1525cae7cf1b0e2963e79ec9c81831e8c6eed [path history] [tgz]
  1. mpg_pipeline.png
  2. mpg_pipeline.py
  3. mpg_pipeline_advanced.png
  4. mpg_pipeline_advanced_target.py
  5. mpg_pipeline_target.py
  6. mpg_script.py
  7. MPGSimple.ipynb
  8. MPGSimpleAdvancedTarget.ipynb
  9. MPGSimpleTarget.ipynb
  10. ProceduralMPGNotebook.ipynb
  11. README.md
  12. requirements.txt
examples/hamilton-tutorials/mpg-translation/README.md

Translation exercise

This is a tutorial that one can use to help people grok Hamilton.

The task is to translate the procedural code into Hamilton. That is:

  1. Translate either mpg_script.py or ProceduralMPGNotebook.ipynb into a Hamilton.
  2. There are two file stubs to fill in: mpg_pipeline.py or MPGSimple.ipynb.

If you get stuck or want to see the solution, you can look at mpg_pipeline_target.py or MPGSimpleTarget.ipynb. These solutions represent a very straight port, and there are many ways to improve them. The point to improving is to show that modifications and updates are quick and easy to make.

For a more advanced translation, you can look at the mpg_pipeline_advanced.py or MPGSimpleAdvancedTarget.ipynb files.

To get set up:

  1. Clone this repository.
  2. Go into the examples/hamilton-tutorials/mpg-translation directory.
  3. Install Hamilton. pip install - requirements.txt
  4. Write code.
  5. Excute via notebook or command line.

Or run it in Google Colab:

  • Procedural Notebook: Open In Colab
  • Simple Notbeook: Open In Colab
  • Target Notebook:Open In Colab