Custom forecast horizon + previous changes - #4
Merged
Merged
Conversation
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
added a commit
that referenced
this pull request
Jul 15, 2026
Custom forecast horizon + previous changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.