Explainable Machine Learning Framework for Predicting Total Dissolved Solids in Residential Groundwater Using RF, MLP, and SHAP
摘要
Accurate prediction of Total Dissolved Solids (TDS) is essential for safeguarding residential groundwater quality and ensuring compliance with drinking water standards. This study aims to develop and compare machine learning models for predicting TDS concentrations based on key water quality parameters, with a focus on model interpretability using explainable AI (XAI) techniques. Specifically, we propose a framework that combines Multi-Layer Perceptron (MLP) and SHapley Additive exPlanations (SHAP) and benchmark its performance against a Random Forest (RF) model. The models were trained and validated using a residential groundwater dataset that contained parameters such as conductivity, hardness, chloride, alkalinity, sulfate, and pH. The MLP model demonstrated strong predictive accuracy, with Root Mean Square Error (RMSE) values of 137.4 mg/L for the training set and 155.4 mg/L for the testing set. The RF model yielded a testing RMSE of 182.1 mg/L, indicating lower generalization performance compared to MLP. To enhance interpretability, SHAP analysis was applied to the MLP model to quantify the contribution of each input feature to the TDS predictions. The SHAP summary and global bar plots revealed that electrical conductivity was the most dominant predictor, followed by alkalinity, hardness, sulphate, and chloride. pH contributed minimally to the model output. By integrating machine learning with explainable AI, this framework provides both accurate predictions and transparent insights into feature relevance, making it a valuable decision-support tool for environmental monitoring, residential water quality management, and regulatory policy in water-sensitive communities.