bugfix wunderground reporting

This commit is contained in:
2026-03-09 09:19:45 +11:00
parent 5b8cad905f
commit c796f1324e
12 changed files with 253 additions and 33 deletions

View File

@@ -47,6 +47,12 @@ Feature-set options:
- `extended`: adds wind-direction encoding, lag/rolling stats, recent rain accumulation,
and aligned forecast features from `forecast_openmeteo_hourly`.
Model-family options (`train_rain_model.py`):
- `logreg`: logistic regression baseline.
- `hist_gb`: histogram gradient boosting (tree-based baseline).
- `auto`: trains both `logreg` and `hist_gb`, picks the best validation model by
PR-AUC, then ROC-AUC, then F1.
## Usage
### 1) Apply schema update (existing DBs)
`001_schema.sql` now includes `predictions_rain_1h`.
@@ -79,6 +85,7 @@ python scripts/train_rain_model.py \
--val-ratio 0.15 \
--min-precision 0.70 \
--feature-set "baseline" \
--model-family "logreg" \
--model-version "rain-logreg-v1" \
--out "models/rain_model.pkl" \
--report-out "models/rain_model_report.json" \
@@ -92,6 +99,7 @@ python scripts/train_rain_model.py \
--start "2026-02-01T00:00:00Z" \
--end "2026-03-03T23:55:00Z" \
--feature-set "extended" \
--model-family "logreg" \
--forecast-model "ecmwf" \
--model-version "rain-logreg-v1-extended" \
--out "models/rain_model_extended.pkl" \
@@ -99,6 +107,35 @@ python scripts/train_rain_model.py \
--dataset-out "models/datasets/rain_dataset_{model_version}_{feature_set}.csv"
```
### 3c) Train tree-based baseline (P1)
```sh
python scripts/train_rain_model.py \
--site "home" \
--start "2026-02-01T00:00:00Z" \
--end "2026-03-03T23:55:00Z" \
--feature-set "extended" \
--model-family "hist_gb" \
--forecast-model "ecmwf" \
--model-version "rain-hgb-v1-extended" \
--out "models/rain_model_hgb.pkl" \
--report-out "models/rain_model_report_hgb.json" \
--dataset-out "models/datasets/rain_dataset_{model_version}_{feature_set}.csv"
```
### 3d) Auto-compare logistic vs tree baseline
```sh
python scripts/train_rain_model.py \
--site "home" \
--start "2026-02-01T00:00:00Z" \
--end "2026-03-03T23:55:00Z" \
--feature-set "extended" \
--model-family "auto" \
--forecast-model "ecmwf" \
--model-version "rain-auto-v1-extended" \
--out "models/rain_model_auto.pkl" \
--report-out "models/rain_model_report_auto.json"
```
### 4) Run inference and store prediction
```sh
python scripts/predict_rain_model.py \