How kirithikji/ml_do_ensemble_model works
This repository builds an early-warning system for low dissolved oxygen at US river stations. Its main workflow collects sensor, weather, and air-quality data; cleans and featurizes hourly records; trains and combines forecasts; selects a probability threshold for warnings; evaluates a frozen system; and runs live forecasts and monitoring. Separate deployment tools fetch live inputs, expose forecasts, and gate retraining. README statements establish the pipeline links; source excerpts and the index support the model-service and deployment relationships. Several detailed evaluation and deployment internals are unsampled.
Main entry points: predict_service.py Forecast service · fetch_live.py Live data fetch · run_step7.py Cross-fit selection · run.py Live forecast run
Components 26
Data preparation
- Historical collection
src/data/download.py - Data checks
src/data/check_data.py - Hourly cleaning
src/data/clean.py - Feature building
src/features/build_features.py - Processed datasets
src/features/build_features.py
Forecast modeling
- Baselines and trees
src/models/train_ml.py - Deep models
src/models/train_dl.py - Model ensembles
src/models/ensemble.py - Cross-fit selection
src/models/run_step7.py - Warning threshold
src/models/run_step7.py - Forecast service
src/models/predict_service.py
Evaluation
- Forecast metrics
src/evaluation/metrics.py - Evaluation reports
src/evaluation/final_report.py - Model freeze
src/models/freeze.py
Live deployment
- Live data fetch
src/deploy/fetch_live.py - Live forecast run
src/deploy/run.py - Forecast monitoring
src/deploy/monitor.py - Forecast API
src/deploy/api.py - Promotion gate
src/deploy/retrain.py - 2026 scoring
src/deploy/score_2026.py - Forecast logs
src/deploy/run.py
Shared runtime
- Configuration
src/config.py - Deployment utilities
src/deploy/common.py
Other components
- USGS sensors
- Open-Meteo
- River operator
Connections 36
- USGS sensors → Historical collection: supplies readings
README.md - Open-Meteo → Historical collection: supplies weather and air
README.md - Historical collection → Data checks: checks collected data
README.md - Data checks → Hourly cleaning: validates inputs
README.md - Hourly cleaning → Feature building: provides hourly data
README.md - Feature building → Processed datasets: writes datasets
README.md - Processed datasets → Baselines and trees: trains and scores
README.md - Processed datasets → Deep models: trains and scores
README.md - Baselines and trees → Model ensembles: writes predictions
README.md - Deep models → Model ensembles: writes predictions
README.md - Model ensembles → Cross-fit selection: provides members
src/models/run_step7.py - Cross-fit selection → Warning threshold: selects threshold
README.md - Cross-fit selection → Evaluation reports: reports validation
README.md - Warning threshold → Forecast service: applies frozen rule
src/models/predict_service.py - Forecast service → Forecast metrics: classifies forecasts
src/models/predict_service.py - Forecast metrics → Evaluation reports: scores forecasts
src/evaluation/final_report.py - Cross-fit selection → Model freeze: freezes selected system
README.md - Model freeze → Forecast service: supplies frozen models
README.md - Open-Meteo → Live data fetch: supplies live weather
README.md - USGS sensors → Live data fetch: supplies live readings
README.md - Live data fetch → Live forecast run: provides current data
README.md - Live forecast run → Forecast service: requests forecasts
src/deploy/run.py - Live forecast run → Forecast logs: writes forecast rows
README.md - Forecast logs → Forecast monitoring: provides logged forecasts
README.md - Forecast monitoring → Forecast metrics: scores observed forecasts
src/deploy/monitor.py - River operator → Forecast API: requests forecasts
README.md - Forecast API → Forecast service: serves forecast results
README.md - Promotion gate → Forecast service: checks model promotion
README.md - Live data fetch → 2026 scoring: provides 2026 inputs
README.md - 2026 scoring → Forecast service: scores deployed models
src/deploy/score_2026.py - 2026 scoring → Forecast metrics: computes scores
src/deploy/score_2026.py - Configuration → Feature building: configures pipeline
src/features/build_features.py - Configuration → Forecast service: configures inference
src/models/predict_service.py - Deployment utilities → Live forecast run: supports deployment run
src/deploy/run.py - Deployment utilities → Live data fetch: supports data fetch
src/deploy/fetch_live.py - Deployment utilities → 2026 scoring: supports scoring
src/deploy/score_2026.py