update
This commit is contained in:
@@ -110,6 +110,7 @@ Runbook/docs:
|
|||||||
- `docs/rain_data_issues.md`
|
- `docs/rain_data_issues.md`
|
||||||
- `docs/rain_model_runbook.md`
|
- `docs/rain_model_runbook.md`
|
||||||
- `scripts/recommend_rain_model.py` (rank reports and recommend deploy candidate)
|
- `scripts/recommend_rain_model.py` (rank reports and recommend deploy candidate)
|
||||||
|
- `scripts/rainml_py.sh` (run ML Python scripts inside the `rainml` container; avoids host virtualenv/dependency setup)
|
||||||
|
|
||||||
## Publish a test WS90 payload
|
## Publish a test WS90 payload
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ This document captures known data-quality issues observed in the rain-model pipe
|
|||||||
Run this regularly and retain JSON reports for comparison:
|
Run this regularly and retain JSON reports for comparison:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python scripts/audit_rain_data.py \
|
scripts/rainml_py.sh scripts/audit_rain_data.py \
|
||||||
--site home \
|
--site home \
|
||||||
--start "2026-02-01T00:00:00Z" \
|
--start "2026-02-01T00:00:00Z" \
|
||||||
--end "2026-03-03T23:55:00Z" \
|
--end "2026-03-03T23:55:00Z" \
|
||||||
|
|||||||
+10
-10
@@ -25,7 +25,7 @@ docker compose exec -T timescaledb \
|
|||||||
Recommended evaluation run (includes validation-only tuning, calibration comparison, naive baselines, and walk-forward folds):
|
Recommended evaluation run (includes validation-only tuning, calibration comparison, naive baselines, and walk-forward folds):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python scripts/train_rain_model.py \
|
scripts/rainml_py.sh scripts/train_rain_model.py \
|
||||||
--site "home" \
|
--site "home" \
|
||||||
--start "2026-02-01T00:00:00Z" \
|
--start "2026-02-01T00:00:00Z" \
|
||||||
--end "2026-03-03T23:55:00Z" \
|
--end "2026-03-03T23:55:00Z" \
|
||||||
@@ -59,7 +59,7 @@ Review in report:
|
|||||||
2. Run one dry-run inference:
|
2. Run one dry-run inference:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python scripts/predict_rain_model.py \
|
scripts/rainml_py.sh scripts/predict_rain_model.py \
|
||||||
--site home \
|
--site home \
|
||||||
--model-path "models/rain_model.pkl" \
|
--model-path "models/rain_model.pkl" \
|
||||||
--model-name "rain_next_4h" \
|
--model-name "rain_next_4h" \
|
||||||
@@ -70,7 +70,7 @@ python scripts/predict_rain_model.py \
|
|||||||
3. Run live inference:
|
3. Run live inference:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python scripts/predict_rain_model.py \
|
scripts/rainml_py.sh scripts/predict_rain_model.py \
|
||||||
--site home \
|
--site home \
|
||||||
--model-path "models/rain_model.pkl" \
|
--model-path "models/rain_model.pkl" \
|
||||||
--model-name "rain_next_4h" \
|
--model-name "rain_next_4h" \
|
||||||
@@ -128,7 +128,7 @@ Alert heuristic: sustained Brier-score increase > 25% from trailing 30-day avera
|
|||||||
Use the health-check script in cron, systemd timer, or your alerting scheduler:
|
Use the health-check script in cron, systemd timer, or your alerting scheduler:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python scripts/check_rain_pipeline_health.py \
|
scripts/rainml_py.sh scripts/check_rain_pipeline_health.py \
|
||||||
--site home \
|
--site home \
|
||||||
--model-name rain_next_4h \
|
--model-name rain_next_4h \
|
||||||
--horizon-hours 4 \
|
--horizon-hours 4 \
|
||||||
@@ -164,7 +164,7 @@ Recommended production defaults:
|
|||||||
To compare saved training reports and pick a deployment candidate automatically:
|
To compare saved training reports and pick a deployment candidate automatically:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python scripts/recommend_rain_model.py \
|
scripts/rainml_py.sh scripts/recommend_rain_model.py \
|
||||||
--reports-glob "models/rain_model_report*.json" \
|
--reports-glob "models/rain_model_report*.json" \
|
||||||
--require-walk-forward \
|
--require-walk-forward \
|
||||||
--top-k 5 \
|
--top-k 5 \
|
||||||
@@ -194,7 +194,7 @@ docker compose exec -T timescaledb \
|
|||||||
3. Run a full 4h training/evaluation cycle and save report:
|
3. Run a full 4h training/evaluation cycle and save report:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python scripts/train_rain_model.py \
|
scripts/rainml_py.sh scripts/train_rain_model.py \
|
||||||
--site "home" \
|
--site "home" \
|
||||||
--start "2026-02-01T00:00:00Z" \
|
--start "2026-02-01T00:00:00Z" \
|
||||||
--end "2026-03-03T23:55:00Z" \
|
--end "2026-03-03T23:55:00Z" \
|
||||||
@@ -213,21 +213,21 @@ python scripts/train_rain_model.py \
|
|||||||
4. Compare 4h metrics against the latest 1h benchmark report before switching dashboard defaults:
|
4. Compare 4h metrics against the latest 1h benchmark report before switching dashboard defaults:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python scripts/compare_rain_reports.py \
|
scripts/rainml_py.sh scripts/compare_rain_reports.py \
|
||||||
--baseline "models/rain_model_report_1h.json" \
|
--baseline "models/rain_model_report_1h.json" \
|
||||||
--candidate "models/rain_model_report_4h.json"
|
--candidate "models/rain_model_report_4h.json"
|
||||||
```
|
```
|
||||||
5. Run dry-run inference, then live inference with 4h model name/horizon:
|
5. Run dry-run inference, then live inference with 4h model name/horizon:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python scripts/predict_rain_model.py \
|
scripts/rainml_py.sh scripts/predict_rain_model.py \
|
||||||
--site home \
|
--site home \
|
||||||
--model-path "models/rain_model_4h.pkl" \
|
--model-path "models/rain_model_4h.pkl" \
|
||||||
--model-name "rain_next_4h" \
|
--model-name "rain_next_4h" \
|
||||||
--horizon-hours 4 \
|
--horizon-hours 4 \
|
||||||
--dry-run
|
--dry-run
|
||||||
|
|
||||||
python scripts/predict_rain_model.py \
|
scripts/rainml_py.sh scripts/predict_rain_model.py \
|
||||||
--site home \
|
--site home \
|
||||||
--model-path "models/rain_model_4h.pkl" \
|
--model-path "models/rain_model_4h.pkl" \
|
||||||
--model-name "rain_next_4h" \
|
--model-name "rain_next_4h" \
|
||||||
@@ -237,7 +237,7 @@ python scripts/predict_rain_model.py \
|
|||||||
6. Validate health checks and dashboard data path for 4h:
|
6. Validate health checks and dashboard data path for 4h:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python scripts/check_rain_pipeline_health.py \
|
scripts/rainml_py.sh scripts/check_rain_pipeline_health.py \
|
||||||
--site home \
|
--site home \
|
||||||
--model-name rain_next_4h \
|
--model-name rain_next_4h \
|
||||||
--horizon-hours 4 \
|
--horizon-hours 4 \
|
||||||
|
|||||||
+10
-10
@@ -90,7 +90,7 @@ All examples below assume a 4-hour horizon (`--horizon-hours 4`) and `model-name
|
|||||||
```sh
|
```sh
|
||||||
export DATABASE_URL="postgres://postgres:postgres@localhost:5432/micrometeo?sslmode=disable"
|
export DATABASE_URL="postgres://postgres:postgres@localhost:5432/micrometeo?sslmode=disable"
|
||||||
|
|
||||||
python scripts/audit_rain_data.py \
|
scripts/rainml_py.sh scripts/audit_rain_data.py \
|
||||||
--site home \
|
--site home \
|
||||||
--start "2026-02-01T00:00:00Z" \
|
--start "2026-02-01T00:00:00Z" \
|
||||||
--end "2026-03-03T23:55:00Z" \
|
--end "2026-03-03T23:55:00Z" \
|
||||||
@@ -100,7 +100,7 @@ python scripts/audit_rain_data.py \
|
|||||||
|
|
||||||
### 3) Train baseline model
|
### 3) Train baseline model
|
||||||
```sh
|
```sh
|
||||||
python scripts/train_rain_model.py \
|
scripts/rainml_py.sh scripts/train_rain_model.py \
|
||||||
--site "home" \
|
--site "home" \
|
||||||
--start "2026-02-01T00:00:00Z" \
|
--start "2026-02-01T00:00:00Z" \
|
||||||
--end "2026-03-03T23:55:00Z" \
|
--end "2026-03-03T23:55:00Z" \
|
||||||
@@ -117,7 +117,7 @@ python scripts/train_rain_model.py \
|
|||||||
|
|
||||||
### 3b) Train expanded (P1) feature-set model
|
### 3b) Train expanded (P1) feature-set model
|
||||||
```sh
|
```sh
|
||||||
python scripts/train_rain_model.py \
|
scripts/rainml_py.sh scripts/train_rain_model.py \
|
||||||
--site "home" \
|
--site "home" \
|
||||||
--start "2026-02-01T00:00:00Z" \
|
--start "2026-02-01T00:00:00Z" \
|
||||||
--end "2026-03-03T23:55:00Z" \
|
--end "2026-03-03T23:55:00Z" \
|
||||||
@@ -132,7 +132,7 @@ python scripts/train_rain_model.py \
|
|||||||
|
|
||||||
### 3b.1) Train expanded + calendar (P2) feature-set model
|
### 3b.1) Train expanded + calendar (P2) feature-set model
|
||||||
```sh
|
```sh
|
||||||
python scripts/train_rain_model.py \
|
scripts/rainml_py.sh scripts/train_rain_model.py \
|
||||||
--site "home" \
|
--site "home" \
|
||||||
--start "2026-02-01T00:00:00Z" \
|
--start "2026-02-01T00:00:00Z" \
|
||||||
--end "2026-03-03T23:55:00Z" \
|
--end "2026-03-03T23:55:00Z" \
|
||||||
@@ -146,7 +146,7 @@ python scripts/train_rain_model.py \
|
|||||||
|
|
||||||
### 3c) Train tree-based baseline (P1)
|
### 3c) Train tree-based baseline (P1)
|
||||||
```sh
|
```sh
|
||||||
python scripts/train_rain_model.py \
|
scripts/rainml_py.sh scripts/train_rain_model.py \
|
||||||
--site "home" \
|
--site "home" \
|
||||||
--start "2026-02-01T00:00:00Z" \
|
--start "2026-02-01T00:00:00Z" \
|
||||||
--end "2026-03-03T23:55:00Z" \
|
--end "2026-03-03T23:55:00Z" \
|
||||||
@@ -161,7 +161,7 @@ python scripts/train_rain_model.py \
|
|||||||
|
|
||||||
### 3d) Auto-compare logistic vs tree baseline
|
### 3d) Auto-compare logistic vs tree baseline
|
||||||
```sh
|
```sh
|
||||||
python scripts/train_rain_model.py \
|
scripts/rainml_py.sh scripts/train_rain_model.py \
|
||||||
--site "home" \
|
--site "home" \
|
||||||
--start "2026-02-01T00:00:00Z" \
|
--start "2026-02-01T00:00:00Z" \
|
||||||
--end "2026-03-03T23:55:00Z" \
|
--end "2026-03-03T23:55:00Z" \
|
||||||
@@ -175,7 +175,7 @@ python scripts/train_rain_model.py \
|
|||||||
|
|
||||||
### 3e) Full P1 evaluation (tuning + calibration + walk-forward)
|
### 3e) Full P1 evaluation (tuning + calibration + walk-forward)
|
||||||
```sh
|
```sh
|
||||||
python scripts/train_rain_model.py \
|
scripts/rainml_py.sh scripts/train_rain_model.py \
|
||||||
--site "home" \
|
--site "home" \
|
||||||
--start "2026-02-01T00:00:00Z" \
|
--start "2026-02-01T00:00:00Z" \
|
||||||
--end "2026-03-03T23:55:00Z" \
|
--end "2026-03-03T23:55:00Z" \
|
||||||
@@ -194,7 +194,7 @@ python scripts/train_rain_model.py \
|
|||||||
|
|
||||||
### 3f) Walk-forward threshold policy (more temporally robust alert threshold)
|
### 3f) Walk-forward threshold policy (more temporally robust alert threshold)
|
||||||
```sh
|
```sh
|
||||||
python scripts/train_rain_model.py \
|
scripts/rainml_py.sh scripts/train_rain_model.py \
|
||||||
--site "home" \
|
--site "home" \
|
||||||
--start "2026-02-01T00:00:00Z" \
|
--start "2026-02-01T00:00:00Z" \
|
||||||
--end "2026-03-03T23:55:00Z" \
|
--end "2026-03-03T23:55:00Z" \
|
||||||
@@ -210,7 +210,7 @@ python scripts/train_rain_model.py \
|
|||||||
|
|
||||||
### 4) Run inference and store prediction
|
### 4) Run inference and store prediction
|
||||||
```sh
|
```sh
|
||||||
python scripts/predict_rain_model.py \
|
scripts/rainml_py.sh scripts/predict_rain_model.py \
|
||||||
--site home \
|
--site home \
|
||||||
--model-path "models/rain_model.pkl" \
|
--model-path "models/rain_model.pkl" \
|
||||||
--model-name "rain_next_4h" \
|
--model-name "rain_next_4h" \
|
||||||
@@ -252,7 +252,7 @@ docker compose logs -f rainml
|
|||||||
|
|
||||||
### 7) Recommend deploy candidate from saved reports
|
### 7) Recommend deploy candidate from saved reports
|
||||||
```sh
|
```sh
|
||||||
python scripts/recommend_rain_model.py \
|
scripts/rainml_py.sh scripts/recommend_rain_model.py \
|
||||||
--reports-glob "models/rain_model_report*.json" \
|
--reports-glob "models/rain_model_report*.json" \
|
||||||
--require-walk-forward \
|
--require-walk-forward \
|
||||||
--top-k 5 \
|
--top-k 5 \
|
||||||
|
|||||||
Executable
+27
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
cd "$ROOT_DIR"
|
||||||
|
|
||||||
|
if [[ $# -lt 1 ]]; then
|
||||||
|
cat <<'EOF'
|
||||||
|
Usage:
|
||||||
|
scripts/rainml_py.sh <script_or_module> [args...]
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
scripts/rainml_py.sh scripts/train_rain_model.py --site home --horizon-hours 4 ...
|
||||||
|
scripts/rainml_py.sh scripts/predict_rain_model.py --site home --model-name rain_next_4h --horizon-hours 4
|
||||||
|
|
||||||
|
Optional:
|
||||||
|
RAINML_PY_BUILD=1 scripts/rainml_py.sh ...
|
||||||
|
(builds the rainml image before running)
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${RAINML_PY_BUILD:-0}" == "1" ]]; then
|
||||||
|
docker compose build rainml
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker compose run --rm --no-deps --entrypoint python3 rainml "$@"
|
||||||
@@ -22,7 +22,7 @@ if [[ -z "${DATABASE_URL:-}" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Running rain data audit..."
|
echo "Running rain data audit..."
|
||||||
python scripts/audit_rain_data.py \
|
python3 scripts/audit_rain_data.py \
|
||||||
--site "$SITE" \
|
--site "$SITE" \
|
||||||
--start "$START" \
|
--start "$START" \
|
||||||
--end "$END" \
|
--end "$END" \
|
||||||
@@ -32,7 +32,7 @@ python scripts/audit_rain_data.py \
|
|||||||
--out "$AUDIT_PATH"
|
--out "$AUDIT_PATH"
|
||||||
|
|
||||||
echo "Training baseline rain model..."
|
echo "Training baseline rain model..."
|
||||||
python scripts/train_rain_model.py \
|
python3 scripts/train_rain_model.py \
|
||||||
--site "$SITE" \
|
--site "$SITE" \
|
||||||
--start "$START" \
|
--start "$START" \
|
||||||
--end "$END" \
|
--end "$END" \
|
||||||
@@ -51,7 +51,7 @@ python scripts/train_rain_model.py \
|
|||||||
--dataset-out "$DATASET_PATH"
|
--dataset-out "$DATASET_PATH"
|
||||||
|
|
||||||
echo "Writing current prediction..."
|
echo "Writing current prediction..."
|
||||||
python scripts/predict_rain_model.py \
|
python3 scripts/predict_rain_model.py \
|
||||||
--site "$SITE" \
|
--site "$SITE" \
|
||||||
--model-path "$MODEL_PATH" \
|
--model-path "$MODEL_PATH" \
|
||||||
--model-name "$MODEL_NAME" \
|
--model-name "$MODEL_NAME" \
|
||||||
|
|||||||
Reference in New Issue
Block a user