journal article·2025-06-27Open access

A Comparative Study of Advanced Transformer Learning Frameworks for Water Potability Analysis Using Physicochemical Parameters

Enes Algül, Saadin Oyucu, Onur Polat, Hüseyin Çelik, Süleyman Ekşi, Faruk Kurker, Ahmet Aksoz

Applied Sciences· Volume 15· Issue 13

Abstract

Keeping drinking water safe is a critical aspect of protecting public health. Traditional laboratory-based methods for evaluating water potability are often time-consuming, costly, and labour-intensive. This paper presents a comparative analysis of four transformer-based deep learning models in the development of automatic classification systems for water potability based on physicochemical attributes. The models examined include the enhanced tabular transformer (ETT), feature tokenizer transformer (FTTransformer), self-attention and inter-sample network (SAINT), and tabular autoencoder pretraining enhancement (TAPE). The study utilized an open-access water quality dataset that includes nine key attributes such as pH, hardness, total dissolved solids (TDS), chloramines, sulphate, conductivity, organic carbon, trihalomethanes, and turbidity. The models were evaluated under a unified protocol involving 70–15–15 data partitioning, five-fold cross-validation, fixed random seed, and consistent hyperparameter settings. Among the evaluated models, the enhanced tabular transformer outperforms other models with an accuracy of 95.04% and an F1 score of 0.94. ETT is an advanced model because it can efficiently model high-order feature interactions through multi-head attention and deep hierarchical encoding. Feature importance analysis consistently highlighted chloramines, conductivity, and trihalomethanes as key predictive features across all models. SAINT demonstrated robust generalization through its dual-attention mechanism, while TAPE provided competitive results with reduced computational overhead due to unsupervised pretraining. Conversely, FTTransformer showed limitations, likely due to sensitivity to class imbalance and hyperparameter tuning. The results underscore the potential of transformer-based models, especially ETT, in enabling efficient, accurate, and scalable water quality monitoring. These findings support their integration into real-time environmental health systems and suggest approaches for future research in explainability, domain adaptation, and multimodal fusion.
Source: crossref · Quality: baseline

Research context

OpenAlex topics: Neural Networks and Applications · Water Quality Monitoring Technologies · Electrochemical Analysis and Applications

SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.

Affiliations

Department of Computer Engineering, Bingöl University, Bingol 12000, Turkey

Department of Computer Engineering, Faculty of Technology, Gazi University, Ankara 06560, Türkiye

Manas Enerji Yonetimi Sanayi ve Ticaret A.S., Ankara 06935, Türkiye

Department of Electrical and Electronic Engineering, Faculty of Engineering, Adıyaman University, Adıyaman 02040, Türkiye

Department of Electrical and Electronics Engineering, Faculty of Engineering, Architecture and Design, Kayseri University, Kayseri 38380, Türkiye

Funding

MANAS Enerji Yonetimi Sanayi ve Ticaret A.S.

References (30)

Show source-provided references
1. World Health Organization (2025, April 12). Drinking-Water, Available online: https://www.who.int/news-room/fact-sheets/detail/drinking-water.
2. Patel, S., Shah, K., Vaghela, S., Aglodiya, M., and Bhattad, R. (2023). Water Potability Prediction Using Machine Learning. Preprints, 2023052965.10.21203/rs.3.rs-2965961/v1 ↗
3. Bellur, A.P., VL, V.K., Choudary, S.K., Kodipalli, A., Rao, T., and Pushpalatha, V. (2023, January 10–11). Water Quality Assessment Using Machine Learning: A Comparative Analysis. Proceedings of the 2023 International Conference on Computational Intelligence for Information, Security and Communication Applications (CIISCA), Bengaluru, India.10.1109/CIISCA59740.2023.00068 ↗
4. Gorishniy, Y., Rubachev, I., Khrulkov, V., and Babenko, A. (2021). Revisiting Deep Learning Models for Tabular Data. arXiv, Available online: https://arxiv.org/abs/2106.11959.
5. TabNet: Attentive Interpretable Tabular Learning
6. Huang, X., Khetan, A., Cvitkovic, M., and Karnin, Z. (2020). TabTransformer: Tabular Data Modeling Using Contextual Embeddings. arXiv.
7. Somepalli, G., Goldblum, M., Schwarzschild, A., Bruss, C.B., and Goldstein, T. (2021). SAINT: Improved Neural Networks for Tabular Data via Row Attention and Contrastive Pre-Training. arXiv.
8. Amarbayasgalan, T., Pham, V.H., Theera-Umpon, N., and Ryu, K.H. (2020). Unsupervised Anomaly Detection Approach for Time-Series in Multi-Domains Using Deep Reconstruction Error. Symmetry, 12.10.3390/sym12081251 ↗
9. Classification Based on Decision Tree Algorithm for Machine Learning10.38094/jastt20165 ↗
10. Performance Analysis of the Water Quality Index Model for Predicting Water State Using Machine Learning Techniques10.1016/j.psep.2022.11.073 ↗
11. An Improved Random Forest Based on the Classification Accuracy and Correlation Measurement of Decision Trees10.1016/j.eswa.2023.121549 ↗
12. Chen, T., and Guestrin, C. (2016, January 13–17). XGBoost: A Scalable Tree Boosting System. Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA.10.1145/2939672.2939785 ↗
13. Water Quality Prediction Using Machine Learning10.47760/ijcsmc.2023.v12i04.006 ↗
14. A Neural Network Boosting Regression Model Based on XGBoost10.1016/j.asoc.2022.109067 ↗
15. Chen, W., Xu, D., Pan, B., Zhao, Y., and Song, Y. (2024). Machine Learning-Based Water Quality Classification Assessment. Water, 16.10.3390/w16202951 ↗
16. Grinsztajn, L., Oyallon, E., and Varoquaux, G. (2022). Why Do Tree-Based Models Still Outperform Deep Learning on Tabular Data?. arXiv, Available online: https://arxiv.org/abs/2207.08815.
17. Representation Learning: A Review and New Perspectives10.1109/TPAMI.2013.50 ↗
18. Erhan, D., Courville, A., Bengio, Y., and Vincent, P. (2010, January 13–15). Why Does Unsupervised Pre-Training Help Deep Learning?. Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics (AISTATS), Chia Laguna Resort, Sardinia, Italy.
19. Comparative Analysis of Machine Learning Algorithms for Water Quality Prediction10.16993/tellusa.4069 ↗
20. Hybrid Deep Learning Based Prediction for Water Quality of Plain Watershed10.1016/j.envres.2024.119911 ↗
21. A Comparison of Artificial Neural Network (ANN) and Long Short-Term Memory (LSTM) in River Water Quality Prediction10.47191/ijcsrr/V7-i4-02 ↗
22. Gan, M., Pan, S., Chen, Y., Cheng, C., Pan, H., and Zhu, X. (2021). Application of the Machine Learning LightGBM Model to the Prediction of the Water Levels of the Lower Columbia River. J. Mar. Sci. Eng., 9.10.3390/jmse9050496 ↗
23. Research on Surface Water Quality Prediction Based on a CNN-BiLSTM-Attention Combined Deep Learning Approach10.1051/e3sconf/202339301007 ↗
24. Gymprathap, K., and Water Quality Dataset (2025, April 12). Data.World. Available online: https://data.world/gymprathap/water-quality-dataset.
25. Little, R.J.A., and Donald, B.R. (2019). Statistical Analysis with Missing Data, John Wiley & Sons.10.1002/9781119482260 ↗
26. Hastie, T., Tibshirani, R., and Friedman, J. (2009). The Elements of Statistical Learning, Springer.10.1007/978-0-387-84858-7 ↗
27. Norris, J.R. (1998). Markov Chains, Cambridge University Press.10.1017/CBO9780511810633 ↗
28. Attention Is All You Need
29. Hendrycks, D., and Gimpel, K. (2016). Gaussian Error Linear Units (GELUs). arXiv, Available online: https://arxiv.org/abs/1606.08415.
30. Samek, W., Montavon, G., Vedaldi, A., Hansen, L.K., and Müller, K.-R. (2019). Explainable AI: Interpreting, Explaining and Visualizing Deep Learning, Springer Nature.10.1007/978-3-030-28954-6 ↗