Sales Forecasting with the Prophet Library, Part 2

Nina Feshchenko9 Dec 2024

Problem

A telecom operator needs monthly forecasts of home internet (FTTB) and convergent sales for every channel, branch and segment. There are about a thousand such groups. Roughly half have a clear trend, pronounced seasonality and stable sales. The rest have no trend, almost zero sales or a flickering pattern, so they need a different model.

Example from the article: at the tuning stage the best of 30 Prophet configurations had a MAPE of 0.98% and the worst 2.67%. The final run needed 1000+ model fits.

Solution in brief

Choose Prophet's three main hyperparameters on a small grid scored by MAPE and MAE. Then split the groups with a simple flag: average sales over the last 3 months against a threshold. Groups above it get a trend model, the rest get growth = flat. Fit one model per group, join the results and sum them by month.

Questions this case answers
  • How to forecast many short, strongly seasonal sales series at group level when some series have no trend and sell almost nothing
  • How to choose forecasting model hyperparameters by a small grid and an error metric when a full search is too slow
  • How to choose Prophet hyperparameters when seasonality is strong and the history is short?
  • How to forecast monthly sales for more than a thousand channel, branch and segment groups with one pipeline?

Tools and methods

  • Prophet — additive trend, seasonality and holiday forecasting model, one model per group
  • Grid search on a hold-out — 30 hyperparameter combinations ranked by MAPE
  • Trend/no-trend flag — routes each group to growth = linear or growth = flat
  • Apache Spark (PySpark 3.2.4) — pulls the sales data from the cluster
Continue reading — it's free

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