learning-it by example

Back to the video

Time Series Forecasting: Score the Baselines First

Yesterday as the forecast missed by 12.3 a day; the same weekday last week missed by 6.8, and a model only got to 5.4.

Video #192 ยท Machine learning and data science

Steps in the video

  1. 0:00 Baselines first: 12.3, 6.8, then 5.4
  2. 0:30 The idea
  3. 0:59 Setup
  4. 1:20 The made-up shop
  5. 1:44 Three baselines
  6. 2:02 A table for the models
  7. 2:15 Score on later days only
  8. 2:46 Two models
  9. 3:46 What this does not show
  10. 4:31 Mistakes to avoid
  11. 5:09 My take and next steps
  12. 5:45 Recap

Files

  • data.py (11 lines)
  • forecasts.py (21 lines)
  • run.py (28 lines)

Download the code (zip)

Tested with

Python 3.12.15 | numpy==2.5.4, scikit-learn==1.9.1, scipy==1.18.1, joblib==1.6.0, narwhals==2.27.1, threadpoolctl==3.7.0, cloudpickle==3.1.2

What this does not show

Made-up, clean weekly data; one-day-ahead forecasts over one eight-week window; gradient boosting untuned; no classical models.

Sources

Learning IT by Example.