Skip to content

Custom forecast horizon + previous changes - #4

Merged
nawinds merged 4 commits into
mainfrom
development
Jun 7, 2026
Merged

Custom forecast horizon + previous changes#4
nawinds merged 4 commits into
mainfrom
development

Conversation

@nawinds

@nawinds nawinds commented Jun 7, 2026

Copy link
Copy Markdown
Member

No description provided.

BeganovR added 4 commits May 27, 2026 09:28
Walk-forward evaluation: for each historical hourly point, predicts using
only data strictly before that timestamp (no lookahead), then compares
against actual occupancy.

Usage:
    python -m parktrack_ml.evaluate            # last 30 days, all zones
    python -m parktrack_ml.evaluate --days 60
    python -m parktrack_ml.evaluate --days 30 --zone-id 3

Report includes: overall accuracy + MAE, per-class precision/recall/F1,
per-zone breakdown, per-hour-of-day accuracy (catches static-forecast
regression), and a text confusion matrix.
Generates 6 PNG charts from backtest results:
- confusion_matrix.png
- accuracy_by_hour.png  (catches static-forecast regression)
- per_zone_metrics.png
- class_metrics.png     (F1 per class)
- predicted_vs_actual.png
- feature_importance.png

Usage: python -m parktrack_ml.visualize --days 30 --out ./charts
Multi-day historical averages flatten out the real daily pattern — e.g.
for a zone that is 0% at night and 70% during the day, _hist_avg() returns
~30% for all hours, making every forecast slot look identical.

Fix: when a lag timestamp falls in the future (no real data yet), first try
the same timestamp shifted back 24h (yesterday at the same hour). Yesterday's
22:00 was 0% → today's 22:00 forecast gets lag_1h=0.00, not 0.30.

Also deduplicate history index before lookups to prevent Series→float errors.
Default changed from 24h to 48h (96 slots per run).
Override via env: FORECAST_HOURS=24
@nawinds
nawinds merged commit fe8ed2b into main Jun 7, 2026
6 checks passed
nawinds added a commit that referenced this pull request Jul 15, 2026
Custom forecast horizon + previous changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants