Physics Informed Machine Learning for Electrical Sensing and Prediction of Heavy Metal Contamination in Water
DOI:
https://doi.org/10.71170/tecoj.2026.2.2.pp42-58Keywords:
Water Quality, Machine Learning, Heavy Metals , Random Forest, Electrochemical SensorsAbstract
Access to safe drinking water remains a global challenge, with approximately 2.1 billion people lacking safely managed water services. Continuous, low-cost monitoring of heavy metal contamination is limited because conventional techniques such as atomic absorption spectroscopy (AAS) and inductively coupled plasma mass spectrometry (ICP-MS) are accurate but require centralized laboratories and high operational costs. Although machine learning has shown promise for water quality prediction, existing models are generally trained on empirical datasets and lack the physical constraints governing sensor behavior. This study addresses this limitation by developing a physics-informed machine learning framework based on a physically consistent synthetic dataset of 300 samples generated from Ohm's law, Kohlrausch's law of molar conductivity, and metal-hydrolysis pH chemistry. The dataset was utilized to predict heavy metal concentration from voltage, current, conductivity, temperature and pH. The Random Forest (RF) and Multi-Layer Perceptron Artificial Neural Network (ANN) models were benchmarked against linear regression using cross-validation of 5-folds and 10-folds. The ANN was optimized with L2 regularization and early stopping. During 5-fold cross-validation, the accuracy of RF was found to have R² of 0.38 ± 0.13 (RMSE = 0.049 ± 0.004 mg/L; MAE = 0.039 ± 0.003 mg/L), while ANN optimization was improved from R² = −0.05 till 0.22. Linear regression produced the best performance (R² = 0.47 ± 0.16), consistent with the predominantly linear physics underlying the dataset. Conductivity was identified as the dominant predictor, accounting for approximately 87% of RF feature importance and remaining robust under simulated sensor noise of up to 10%. Although the prediction accuracy is not yet sufficient for regulatory-grade quantification, the proposed framework demonstrates that physics-informed synthetic data can support interpretable, reproducible machine learning models for rapid, low-cost screening and prioritization of water samples for laboratory confirmation.