Problem
A finance and commerce data science team at Microsoft needs a daily answer for each of up to N = 100,000 univariate daily time series: what is the forecast for day T, and is the actual value an anomaly? Prophet with default hyperparameters is fast and decent, yet single-series solutions do not scale and tuning per series is not feasible: 20 Optuna trials over 100,000 series took more than 300 hours (12.5 days) on a 64-vCPU, 256 GB Azure VM, while the job must run every day.
Example from the article: the Microsoft Cloud Data Sciences team's Azure finance and commerce series, with forecasts and anomaly flags needed daily.
Solution in brief
Tune Prophet hyperparameters with Optuna on a random sample of about 500 series only. Give every other series the hyperparameters of its nearest sampled series, measured by Dynamic Time Warping (DTW) on normalized data. Flag a day as an anomaly when the actual value falls outside Prophet's 99% uncertainty interval.
Questions this case answers
- How to run per-series forecasting and anomaly detection daily over a huge set of series when per-series hyperparameter search is far too slow
- How to forecast and flag anomalies in daily data for up to 100,000 business time series every day?
- How to tune forecasting hyperparameters when per-series tuning would take 12.5 days?
- How to set anomaly thresholds from a forecast's uncertainty interval without labeled anomalies?
Tools and methods
- Prophet — additive forecasting model with trend, seasonality and holiday effects; also supplies the uncertainty interval
- Optuna — Bayesian hyperparameter search, run only on the sampled subset
- Dynamic Time Warping (DTW) — similarity between series, used to copy tuned hyperparameters
- SMAPE — forecast error, aggregated into 10% buckets across series
Google or a one-time email code. No password.