feat: complete ML pipeline, FastAPI service, small model, tests, image

- finish the global HistGB bundle, scenario forecasts and 28-day ablation
- export sensors/series/forecasts/metrics/context plus baked weather frames
- add FastAPI health/meta/predict/simulate and background /train jobs
- add the p75 busy classifier, retraining from CSV, and hot-swap persistence
- add pytest coverage, multi-stage non-root Dockerfile, README and model card

Holdout: weather 7d MAE 3.32 / WAPE 27.5% / R2 0.777 vs seasonal naive
MAE 4.23 / WAPE 35.0% / R2 0.656 (5,350 eval rows).
This commit is contained in:
Noel Sabia committed 2026-11-14 05:01:16 +01:00
1 parent 68402803b2
commit 939a8db482
43 files changed
+4090 -105

No files matched your search

+100
View File
@@ -0,0 +1,100 @@
{
"data_version": "2026-11-07T23:51:00Z",
"model_version": "histgb-2026-11-14",
"context_version": "2026-11-14T03:47:09Z",
"coverage": {
"sensors": 8,
"from": "2026-06-12T00:00:00Z",
"to": "2026-11-07T23:51:00Z",
"cadence_min": 15
},
"metrics": {
"model": "weather-7d",
"mae": 3.32,
"wape": 27.5,
"r2": 0.777,
"baseline": "seasonal_naive",
"baseline_mae": 4.23,
"baseline_wape": 35.0,
"baseline_r2": 0.656,
"n_eval": 5350
},
"trained_at": "2026-11-14T04:00:08Z",
"train_from": "2026-06-12T00:00:00Z",
"train_to": "2026-11-07T23:00:00Z",
"test_from": "2026-10-10T23:00:00Z",
"test_to": "2026-11-07T23:00:00Z",
"features": [
"hour",
"weekday",
"month",
"is_weekend",
"is_holiday",
"sensor_code",
"lag_week",
"seasonal_mean_4w",
"temp_c",
"precip_mm"
],
"holiday_effect": {
"mae_delta": -0.12,
"note": "Holiday flag alone changes MAE by this amount on the holdout; weather is the main driver, holidays are context."
},
"ablation": [
{
"name": "seasonal_naive",
"description": "same local hour last week",
"mae": 4.23,
"wape": 35.0,
"r2": 0.656,
"n": 5350
},
{
"name": "day_no_weather",
"description": "calendar + lags 24/48/168 + 24h/168h rolling means",
"mae": 3.96,
"wape": 32.8,
"r2": 0.706,
"n": 5350
},
{
"name": "day_holiday",
"description": "day-ahead + Baden-Württemberg holiday flag",
"mae": 3.84,
"wape": 31.8,
"r2": 0.732,
"n": 5350
},
{
"name": "day_weather",
"description": "day-ahead + temperature + rain (observed weather)",
"mae": 3.36,
"wape": 27.8,
"r2": 0.763,
"n": 5350
},
{
"name": "week_no_weather",
"description": "7-day-safe calendar + previous same weekday/hour values",
"mae": 4.08,
"wape": 33.8,
"r2": 0.697,
"n": 5350
},
{
"name": "week_weather",
"description": "7-day-safe + temperature + rain (production model)",
"mae": 3.32,
"wape": 27.5,
"r2": 0.777,
"n": 5350
}
],
"limits": [
"estimated devices, not people",
"8 sensors in a ~580 m inner-city cluster",
"5 months of multi-sensor data; no annual seasonality claim",
"observed weather in training, forecast weather in scenarios",
"holidays are context, not a large accuracy claim"
]
}