INFLOW-AI downloads and processes hydrological, satellite, rainfall, moisture, lake-level, and teleconnection data for the INFLOW study area. It trains and evaluates temporal ablation models, retrains the selected model on the latest available history, and produces two-month inundation forecasts with uncertainty intervals and explanations.
- Python 3.11 or newer
- macOS, Linux, or Windows
- Network access for the first data download and later source updates
Install dependencies in a virtual environment:
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
python3 -m pip install -r requirements.txt- Review config.yaml, especially
runtime.target_product. - Run the ablation experiments:
python3 -m model.ablation.run_ablation- Run the prediction pipeline:
python3 __main__.pyThe first data run takes substantially longer. It downloads and builds the historic record for the spatial and temporal datasets, including HDF5 files and aligned temporal CSVs. Later runs update only the available period.
No external data folder needs to be downloaded or copied into the repository. The pipeline creates its required data products under data/.
<<<<<<< HEAD
=======
4. Run Ablation Experiments:
python -m model.ablation.run_ablation --models random_forest,gradient_boosting,elastic_net --cutoff-dates 2025-12-31 --autoregressive-values yes,no --target-types raw,first_differenced,deseasonalised,seasonally_differenced,differenced_anomaly --inundation-products viirs,modis --seed 42
This writes:
- model weights (
.pkl) tomodel/ablation/models/weights/ - experiment metadata and performance metrics to
model/ablation/ablation_experiment_log.csv
The main run writes forecasts under predictions/, including:
temporal_predictions.csv: historical values and future predictionsmodel_performance.json: selected model, test metrics, preprocessing, and runtime retraining metadataprediction_year_by_year_comparison.pngand other forecast plotsexplanations/shap_waterfall_lead_*.png: SHAP driver plots for each forecast leadexplanations/shap_metadata.json: explanation metadata and contribution percentages
A cumulative forecast ledger is written to predictions/forecast_performance.csv.
<<<<<<< HEAD
The repository now includes a dedicated ablation framework in model/ablation/ with:
- One class per model in its own Python file:
model/ablation/models/random_forest_model.pymodel/ablation/models/gradient_boosting_model.pymodel/ablation/models/elastic_net_model.py
- Corresponding serialized model weight files as
.pklartifacts in:model/ablation/models/weights/
- Reproducibility controls:
- Global random seed set for
random,numpy, and TensorFlow (if available)
- Global random seed set for
- Experiment tracking in a single CSV log:
model/ablation/ablation_experiment_log.csv
Each logged experiment row includes:
- Ablation dimensions:
model_typetraining_cutoff_dateautoregressivetarget_type(raw,first_differenced,deseasonalised,seasonally_differenced,differenced_anomaly)inundation_product(viirsormodis)seed
- Dataset properties:
- source path, row counts, feature count
- date range
- target mean/std
- dataset fingerprint hash
- Performance metrics:
calibrationtwcrpsmaermsequantile_loss_95quantile_loss_99peak_precisionpeak_recallpeak_aucpeak_f1
origin/main
The main settings are in config.yaml.
runtime:
target_product: "viirs" # viirs or modisThe target product controls the inundation source, aligned historic directory, temporal cadence, and forecast target.
The ablation.experiments section controls the experiment grid:
modelstraining_cutoff_datesautoregressive_valuestarget_typesinundation_productsseedlog_path
The ablation.pipeline section controls shared model preparation:
target_column- forecast horizon
- calendar features
- target and feature lag blocks
- lag steps such as
[1, 2, 3, 6, 12] - feature selection thresholds and candidate feature counts
- optional PCA
Experiment weights, scalers, feature-selection caches, PCA artifacts, and runtime-retrained weights are stored beneath the configured ablation.artifacts.base_dir.
The ablation runner records experiment metadata and metrics in:
model/ablation/ablation_experiment_log.csv
It stores the selected experiment metadata in:
model/best_temporal_model.json
The main pipeline consumes that metadata, uses the selected feature subsets and transformations, retrains the same model architecture on current data, and then forecasts.
This project is licensed under the MIT License.
For questions or issues, contact Jessica Rapson at jessica.rapson@algorithmicgovernance.org.

