Explainable AI Tools for Hydro-Climate Modelling

Provides a unified workflow for applying Explainable Artificial Intelligence (XAI) methods to hydro-climate predictive models. Functions implement a permutation-based Monte Carlo SHAP estimator (Strumbelj and Kononenko (2014) ; Lundberg and Lee (2017) ), a self-contained locally weighted linear surrogate LIME (Ribeiro et al. (2016) ), and Partial Dependence Plots with Accumulated Local Effects (Friedman (2001) ; Apley and Zhu (2020) ) with hydrology-specific visualisations and interpretation utilities. Supports any model object compatible with the 'DALEX' explainer interface (Biecek (2018) ), including random forests, gradient boosting, and neural networks trained on streamflow, drought indices, flood risk, or evapotranspiration data. Hydrology-standard performance metrics Nash-Sutcliffe Efficiency (NSE, Nash and Sutcliffe (1970) ) and Kling-Gupta Efficiency (KGE, Gupta et al. (2009) ) are computed alongside standard regression metrics. Designed to accompany the book chapter: Islam, S., Dheeraj, A., Ali, S., Kaushal, R. and Venkatesh, G. (2026). Explainable Artificial Intelligence for Hydro-Climatic Modelling: Methods, Applications, and Implementation Using the xaiHydro R Package. In Chandniha, S. K. et al. (Eds.), Hydro-Climate Analytics: Remote Sensing, AI and Geospatial Modelling. Springer.


xaiHydro

Explainable Artificial Intelligence Tools for Hydro-Climate Modelling

CRAN status License: GPL-3


Authors

Name Role Institution
Sadikul Islam Author, Maintainer (aut, cre) ICAR-Indian Institute of Soil and Water Conservation, Dehradun, India
Shakir Ali Author (aut) ICAR-Indian Institute of Soil and Water Conservation, Dehradun, India
Rajesh Kaushal Author (aut) ICAR-Indian Institute of Soil and Water Conservation, Dehradun, India

Maintainer: [email protected]


Overview

xaiHydro provides a unified, hydrology-aware workflow for applying post-hoc Explainable Artificial Intelligence (XAI) to any trained hydro-climate predictive model. Three complementary attribution frameworks are implemented:

Method Reference xaiHydro function
SHAP Lundberg & Lee (2017) hydro_shap()
LIME Ribeiro et al. (2016) hydro_lime()
PDP / ALE Friedman (2001); Apley & Zhu (2020) hydro_pdp()
Permutation importance Breiman (2001) hydro_importance()
Breakdown profiles Biecek & Burzykowski (2021) hydro_breakdown()

An internal model registry auto-detects 13 machine-learning frameworks without user-written prediction wrappers. Hydrology-standard metrics NSE, KGE, and PBIAS are computed alongside RMSE and MAE.

Two fully synthetic datasets calibrated to Indian river-basin conditions enable complete reproducibility without proprietary gauge records:

  • sim_streamflow_data() -- daily hydro-meteorological predictors and streamflow response (m3/s)
  • sim_drought_data() -- monthly predictors and SPEI drought index

Installation

# CRAN (recommended)
install.packages("xaiHydro")

Quick start

library(xaiHydro)

# 1. Generate data
df <- sim_streamflow_data(n = 365, seed = 2026)
y  <- df$streamflow
X  <- df[, setdiff(names(df), "streamflow")]

# 2. Train any supported model
library(randomForest)
rf <- randomForest(x = X, y = y, ntree = 300)

# 3. Build the explainer (model class auto-detected)
exp <- hydro_explainer(rf, X, y, variable = "streamflow", units = "m3/s")

# 4. SHAP global summary
shv <- hydro_shap(exp, nsim = 50)
plot_shap_summary(shv, top_n = 8)

# 5. LIME local explanation
lr <- hydro_lime(exp, new_obs = X[1, , drop = FALSE])
plot_lime_hydro(lr)

# 6. PDP / ALE profiles
pdp <- hydro_pdp(exp, variable = c("precipitation", "soil_moisture"))
plot_pdp_hydro(pdp)

# 7. Permutation importance
imp <- hydro_importance(exp, B = 20)
plot_importance_hydro(imp)

# 8. Full report panel
hydro_xai_report(exp, nsim = 50, save_path = "xaiHydro_report.png")

Citation

citation("xaiHydro")

Package:

Islam, S., Ali, S., & Kaushal, R. (2026). xaiHydro: Explainable AI Tools for Hydro-Climate Modelling. R package version 0.1.0. https://CRAN.R-project.org/package=xaiHydro

Accompanying book chapter:

Islam, S., Dheeraj, A., Ali, S., Kaushal, R., & Venkatesh, G. (2026). Explainable Artificial Intelligence for Hydro-Climatic Modelling: Methods, Applications, and Implementation Using the xaiHydro R Package. In S. K. Chandniha, A. Mondal, S. Kundu, A. Pandey, & D. Naidu (Eds.), Hydro-Climate Analytics: Remote Sensing, AI and Geospatial Modelling. Springer.

Key review to cite alongside:

Zounemat-Kermani, M., & Kheimi, M. (2026). Explainable artificial intelligence in hydrology: A review. Water Resources Management, 40(3), 106. https://doi.org/10.1007/s11269-025-04435-9


Key references

  • Apley & Zhu (2020). doi:10.1111/rssb.12377
  • Biecek (2018). doi:10.18637/jss.v097.i01
  • Breiman (2001). doi:10.1023/A:1010933404324
  • Friedman (2001). doi:10.1214/aos/1013203451
  • Gupta et al. (2009). doi:10.1016/j.jhydrol.2009.08.003
  • Lundberg & Lee (2017). doi:10.48550/arXiv.1705.07874
  • Molnar et al. (2018). doi:10.21105/joss.00786
  • Moriasi et al. (2007). doi:10.13031/2013.23153
  • Nash & Sutcliffe (1970). doi:10.1016/0022-1694(70)90255-6
  • Ribeiro et al. (2016). doi:10.1145/2939672.2939778
  • Zounemat-Kermani & Kheimi (2026). doi:10.1007/s11269-025-04435-9

License

GPL-3 (C) 2026 Sadikul Islam, Shakir Ali & Rajesh Kaushal

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("xaiHydro")

0.1.0 by Sadikul Islam, 22 days ago


Browse source code at https://github.com/cran/xaiHydro


Authors: Sadikul Islam [aut, cre] (ORCID: , Shakir Ali [aut] , Rajesh Kaushal [aut]


Documentation:   PDF Manual  


GPL-3 license


Imports DALEX, ggplot2, dplyr, tidyr, patchwork, cli, rlang

Suggests randomForest, xgboost, ranger, testthat, knitr, rmarkdown


See at CRAN