HSMA 8B - Forecasting
Running the code
Due to some environment issues that have not been fully resolved, you may run into issues on some platforms when running the code. This is due to some changes in newer versions of packages that were necessary to include for compatability reasons.
For now, I would recommend just watching the lecture videos.
However, if you are keen to still try the exercises/code-alongs but run into issues, I would recommend skipping to the next part of the exercise/code-along notebook or the next exercise/code-along notebook.
For all code-along notebooks and exercises, you have several options.
Run it locally on your machine using the hsma_forecast environment
- Note that due to some big packages, this may take longer than usual to install
Run the exercises in colab using the buttons next to each exercise on this page
Run the exercises in Github Codespaces, which will give you access to a virtual version of VSCode running in the cloud.
- Click on ‘Use this template’ and ‘Open in a codespace’
- Initial setup may take ~5 minutes - when it is ready, you will see the contents of the repository on the left
- When prompted within the environment to pick a kernel, choose ‘Python environments’ and ‘Python 3.11.10’
- If you need to return to the same codespace later, choose ‘Code’ and ‘Codespaces’, then click the codespace under ‘on current branch’. Yours will have a different autogenerated name.
Part 1 - Introduction to Forecasting Principles and Naive Models
- Watch the recording of the lecture from last year.
https://www.youtube.com/watch?v=akkG4XOf-_E
Slides for part 1: https://github.com/hsma-programme/8b_forecasting/blob/main/HSMA%205%20Slides%20-%20Part%201%20-%20Intro%20to%20Forecasting.pdf
Due to some environment issues that have not been fully resolved, you may run into issues on some platforms when running the code. This is due to some changes in newer versions of packages that were necessary to include for compatability reasons.
For now, I would recommend just watching the lecture videos.
However, if you are keen to still try the exercises/code-alongs but run into issues, I would recommend skipping to the next part of the exercise/code-along notebook or the next exercise/code-along notebook.
Work through the code-along notebooks that Elliott goes through in the video
Have a go at the exercises
Solutions are provided in the solutions folder.
Part 2 - Forecasting with the Prophet library
- Watch the recording of the lecture from last year.
https://www.youtube.com/watch?v=6vFpnSYlUyI
Slides for part 2: https://github.com/hsma-programme/8b_forecasting/blob/main/HSMA%205%20Slides%20-%20Part%202%20-%20Forecasting%20with%20Prophet.pdf
In the video, Elliott uses v1.0.0 of Prophet. The environment contains a newer version this year that should have Mac chip compatability
Due to some environment issues that have not been fully resolved, you may run into issues on some platforms when running the code. This is due to some changes in newer versions of packages that were necessary to include for compatability reasons.
For now, I would recommend just watching the lecture videos.
However, if you are keen to still try the exercises/code-alongs but run into issues, I would recommend skipping to the next part of the exercise/code-along notebook or the next exercise/code-along notebook.
Work through the code-along notebooks that Elliott goes through in the video
Have a go at the exercise
Solutions are provided in the solutions folder.
Optional Bonus Reading and Videos
If you are interested in learning more about forecasting, here are some additional resources.
Book - Forecasting: Principles and Practice
While this eBook is R-focussed, it’s a great overview of various elements of forecasting.
There is a repository of Python equivalent code.
Videos - Advanced forecasting methods
These additional videos are completely optional and only recommended if this is an area you are extremely interested in - even then, Prophet may be sufficient for your use case, and you should be warned that the code used in these videos is complex!
Auto-regressive Forecasting using OLS
You can download the notebook here:
Using Feedforward neural networks for forecasting
You can explore a range of notebooks here:
https://github.com/health-data-science-OR/forecasting/tree/master/06_neural_networks