A Performance Evaluation of K-Nearest Neighbor and Artificial Neural Networks for Predicting Total Dissolved Solids Concentration in Groundwater Sources
Abstract
Total dissolved solids (TDS) is a critical measure of water quality and is vital for human health and ecosystems. The precise forecasting of TDS levels would enhance the management and regulation of contamination, particularly in areas without real-time data. This study aims to forecast TDS levels in groundwater using machine learning (ML) methods such as K-Nearest Neighbor (KNN) and Artificial Neural Networks (ANN), based on data collected from 60 pre-monsoon sites in a tropical river basin. The input features for the two models comprise water quality parameters: pH, electrical conductivity (EC), salinity, total alkalinity (TA), total hardness (TH), and ion concentrations from various components of major cations and anions. TDS has been designated as the target variable. The training utilized 80% of the dataset, reserving 20% for testing purposes. Performance was assessed with Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and R-Squared ( R ²). The KNN model exhibited a MAE of 19.39, an RMSE of 43.94, and an R ² value of 0.88, whereas the ANN model surpassed KNN with an MAE of 7.73, an RMSE of 10.60, and an R ² of 0.99, indicating that the ANN explained 99% of the variation in TDS values. The findings indicate that ANN yields more precise and dependable TDS predictions than KNN. Future studies should concentrate on optimizing model hyperparameters and integrating seasonal fluctuations or other regions to enhance forecasts.
Fields of Study & Subjects
Hydrological Forecasting Using AI
Water Quality and Pollution Assessment
Water Quality and Resources Studies
Publication details
- Journal / source
- CRC Press eBooks
- Pages
- 161–172
- Publication date
- 27 February 2026
- Language
- EN
- Document type
- Book chapter