In this video, you will explore forecasting techniques in Python, including how to use machine learning models from Scikit Learn, as well as integrating R as a sub process to gain access to the robust forecast library, incorporating the auto.arima and tbats models. We create our own Python class called Forecaster that stores all of the relevant information about the predictions, including error metrics, model forms, hyperparameter selections, and the forecasts themselves. The module is written in such a way that models can easily be added to the framework for increasing accuracy.
In the specific scenario, we are forecasting on 150 separate time series—3 time series for each state using economic indicators from the St. Louis Federal Reserve (FRED) website. We build an API to extract the data and add our own indicators that we think will influence the future. At the time that this video is published, the country is experiencing a recession from the COVID-19 pandemic. Therefore, we will extract the recession indicator from the FRED website and make assumptions about how long the recession will last. Using this information, we create an economic outlook for each state. These forecasts can then be used to see which states we expect to recover most quickly from the recession.
This modeling process will be done in Python on a Jupyter Notebook, so it's a good idea to have Anaconda installed on your computer so you can follow along. The rpy2 library from Python will be utilized, so having R installed in your local environment is necessary.
What You Will Learn
Create classes in Python
Make predictions with machine learning and common forecasting models
Manipulate data with Pandas
Store data in base Python structures (lists, dictionaries)
Create APIs and visual aids
Who This Book Is For
Data scientists with experience who are looking to take their forecasting skills to the next level.