Sales Forecasting with the Prophet Library, Part 1

Nina Feshchenko15 Nov 2024

Problem

The sales analytics team of a telecom operator reports new broadband (FTTB) and converged (FMC) connections every day (relocations of an existing contract are excluded) and needs a forecast for the same reports. Sales differ by channel, by branch and by segment, and some channels have only a dozen sales in several months. Sales also swing with weekends, summer vacations, long New Year and May holidays and quarter ends. One model on the total would hide these differences.

Example from the article: Beeline forecasts FTTB-FMC sales for Q4 2024 (October to December) from daily history, separately for each channel-branch-segment value, of which there are more than a thousand.

Solution in brief

Before fitting anything, the author answers four questions about the series: is it homogeneous, does it have a trend, is there seasonality, and how much history to use. The answers lead to one Prophet model per channel-branch-segment group, with a linear (or no) trend, yearly, monthly and weekly seasonality, a holiday calendar and 2 years of history. Parameters are tuned on the aggregate series and scored with MAE and MAPE.

Questions this case answers
  • How to forecast a strongly seasonal daily business metric when it splits into hundreds of heterogeneous segments, some with very little data
  • How to choose the training-history window for a metric whose business priorities have changed over the years
  • How to forecast daily sales for reporting when sales split into more than a thousand channel-branch-segment series?
  • How to decide whether to forecast one aggregate series or many separate ones?

Tools and methods

  • Prophet — additive regression forecaster with trend, seasonality and holiday components
  • Apache Spark (PySpark) — reads the daily sales data stored on the company cluster
  • MAE and MAPE — absolute and relative error used to compare parameter sets
Continue reading — it's free

Google or a one-time email code. No password.