Anas El Khaloui

Picking a forecasting model without trying them all

Most forecasting tools pick a model by brute force. They fit ten candidates on your time series, compare the scores, keep the winner. It's slow, and on short or messy series the winner is often a fluke.

I wanted the opposite: look at the series first, then decide. So I wrote ts_triage, a small Python library.

It works in three steps:

  1. Profile. One pass over the series measures what matters: how seasonal it is, how strong the trend is, how often it's zero, how much is missing, and whether there's any structure at all (a spectral score, 1 for clean cycles, 0 for noise).
  2. Decide. A short, readable decision tree picks the family. Too short or pure noise: a naive forecast. Mostly zeros, like spare parts sales: Croston's method, built for demand that comes in rare bursts. Long horizon or lots of gaps: Prophet. Everything else: exponential smoothing.
  3. Set the parameters. They come from the profile, using rules from the forecasting literature, not from a grid search.

Fitting is optional. Often you only want the decision, and that costs almost nothing.

The part I like most: when a series can't be forecast, it says so. Ask for strict mode and it raises an error with the reason (too short, too sparse, no structure) instead of handing you a confident line through noise.

It won't beat a well-tuned model on a series you know by heart. It's for the other case: thousands of series and no time to look at each one.

Most of the work in forecasting is deciding what to train.

#AI #Tech #english