Member-only story

Create Sales Forecast with Orbit

How to Create a Forecast using Orbit

--

This is a tutorial on how to create a forecast using Orbit. Forecasting is a process of making predictions of the future based on past data and its trends. The accuracy of the forecast decreases as you stretch out your forecast. For example, if you are forecasting monthly sales then the accuracy of the forecast for the month 1 sales forecast will be higher than the month 2 sales forecast, and so on. One of my co-workers likes to state that the best way to predict tomorrow’s weather is to assume it is similar to today’s weather. Everything else is just a guess.

Orbit is a Python package for Bayesian time series modeling and inference. It provides a familiar and intuitive initialize-fit-predict interface for working with time series tasks, while utilizing probabilistic programing languages under the hood per Orbit website (https://orbit-ml.readthedocs.io/en/stable/about.html).

If you are wondering — Orbit is an open-source project from Uber, just like Pyro (https://pyro.ai/). Per Uber, Orbit outperforms Facebook Prophet (https://www.youtube.com/watch?v=LXDpq_iwcWY&t=2978s). I am not sure why it uses Stan under the hood, not Pyro or NumPyro, but I digress.

To maintain the brevity of a tutorial, some of the important steps are not referenced in this tutorial. For a complete code walk-through, please refer to the Github repository referenced in the Resource section at the end of this tutorial. This tutorial was created for me as reference material, therefore the tutorial is heavy on how-to, not on algorithms.

Data

Three data sources were used for this tutorial where United Stated Census Bureau Monthly Retail Sales is used to forecast future sales and both FRED Data and OECD Data were used as Regressors data.

United States Census Bureau Monthly Retail Sales: https://www.census.gov
United States Census Bureau maintains Monthly Retail Trade Report, from January 1992 to the present. This data was picked to illustrate forecasting because it has extensive historical data with the same monthly frequency. Data is available in Excel spreadsheet format at https://www.census.gov/retail/mrts/www/mrtssales92-present.xls

FRED Data: https://fred.stlouisfed.org/

FRED is economic data provided by Federal Reserve Bank of St. Louis.

--

--

Sung Kim
Sung Kim

Written by Sung Kim

A business analyst at heart who dabbles in ai engineering, machine learning, data science, and data engineering. threads: @sung.kim.mw

No responses yet

Write a response