A Firefly Optimization Algorithm for Hyperparameter Tuning of the Support Vector Classifier to Predict Water Potability
Received: 16 June 2025 | Revised: 26 July 2025, 13 August 2025, 21 August 2025, and 22 August 2025 | Accepted: 25 August 2025 | Online: 6 October 2025
Corresponding author: Siddhaling Urolagin
Abstract
Clean water is essential for human health and life, and assessing its potability is critical for safeguarding public well-being. Machine Learning (ML) algorithms have been widely used for water potability classification based on various water quality parameters. However, the performance of these models strongly depends on effective hyperparameter tuning, which remains both challenging and resource-intensive. This study addresses this issue by proposing the Firefly Optimization Algorithm (FOA) to optimize the Support Vector Classifier (SVC) for water potability classification. Traditional hyperparameter tuning methods, such as GridSearchCV and RandomizedSearchCV, often lack the efficiency and effectiveness needed for achieving optimal model performance. In contrast, the proposed FOA-based approach provides a robust solution, demonstrating superior results compared with traditional methods. Model performance was evaluated using accuracy, precision, recall, F1-score, and Area Under the Curve (AUC). The FOA-tuned SVC achieved an accuracy of 0.6773 and an AUC of 0.7065, outperforming models tuned with conventional methods. These findings highlight the potential of nature-inspired optimization techniques, such as the Firefly algorithm, to enhance ML model performance and offer a promising approach to water potability classification.
Keywords:
nature inspired optimization, classification, hyper paramter tuning, firefly optimization, machine learningDownloads
References
Q. Liu, M. Liu, and J. Liu, "Global associations between the use of basic drinking water and sanitation services with diarrhoeal disease incidence in 200 countries and territories from 2000 to 2019," Public Health, vol. 235, pp. 202–210, Oct. 2024.
N. Forstinus, N. Ikechukwu, M. Emenike, and A. Christiana, "Water and Waterborne Diseases: A Review," International Journal of TROPICAL DISEASE & Health, vol. 12, no. 4, pp. 1–14, Jan. 2016.
N. U. H. Shar, G. Q. Shar, A. R. Shar, S. M. Wassan, Z. Q. Bhatti, and A. Ali, "Health Risk Assessment of Arsenic in the Drinking Water of Upper Sindh, Pakistan," Engineering, Technology & Applied Science Research, vol. 11, no. 5, pp. 7558–7563, Oct. 2021.
S. A. Sani, "Drawbacks of Traditional Environmental Monitoring Systems," TMP Universal Journal of Research and Review Archives, vol. 2, no. 2, Jul. 2023.
F. Feng et al., "Machine learning to assess and support safe drinking water supply: a systematic review," Journal of Environmental Chemical Engineering, vol. 13, no. 1, Feb. 2025, Art. no. 114481.
E.-B. Rachid, S. Abderrahim, A. Hafid, and R. Souad, "Predicting water potability using a machine learning approach," Environmental Challenges, vol. 19, Jun. 2025, Art. no. 101131.
K. M. K. Raghunath, S. B. Khan, P. Govindarajan, T. R. Mahesh, M. Alojail, and T. R. Gadekallu, "Machine learning-driven intelligent water quality assessment for enhanced drinking safety and real-time consumer awareness," Hydrology Research, vol. 56, no. 2, pp. 136–152, Feb. 2025.
P. B. Kamath, G. Sharma, A. Bongale, D. Dharrao, and M. Seitshiro, "Exploratory Data Analysis and Water Potability Classification using Supervised Machine Learning Algorithms," Engineering, Technology & Applied Science Research, vol. 15, no. 2, pp. 20898–20903, Apr. 2025.
G. Bwire et al., "The quality of drinking and domestic water from the surface water sources (lakes, rivers, irrigation canals and ponds) and springs in cholera prone communities of Uganda: an analysis of vital physicochemical parameters," BMC Public Health, vol. 20, no. 1, Dec. 2020, Art. no. 1128.
G. Masferrer, R. Carreras, M. Font-i-Furnols, M. Gispert, M. Serra, and P. Marti-Puig, "Automatic ham classification method based on support vector machine model increases accuracy and benefits compared to manual classification," Meat Science, vol. 155, pp. 1–7, Sep. 2019.
R. Guido, M. C. Groccia, and D. Conforti, "A hyper-parameter tuning approach for cost-sensitive support vector machine classifiers," Soft Computing, vol. 27, no. 18, pp. 12863–12881, Sep. 2023.
X.-S. Yang, Nature-inspired optimization algorithms, 1st. edition. Amsterdam Waltham, MA: Elsevier, 2014.
A. M. Bongale and C. R. Nirmala, "Firefly algorithm inspired energy aware clustering protocol for wireless sensor network," International Journal of Communication Networks and Distributed Systems, vol. 23, no. 3, 2019, Art. no. 380.
E. Y. Hidayat et al., "Genetic Algorithm-based Convolutional Neural Network Feature Engineering for Optimizing Coronary Heart Disease Prediction Performance," Healthcare Informatics Research, vol. 30, no. 3, pp. 234–243, Jul. 2024.
A. Mehdary, A. Chehri, A. Jakimi, and R. Saadane, "Hyperparameter Optimization with Genetic Algorithms and XGBoost: A Step Forward in Smart Grid Fraud Detection," Sensors, vol. 24, no. 4, Feb. 2024, Art. no. 1230.
D. N. Quoc and N. T. Tran, "Enhancing Accuracy for Classification Using the CNN Model and Hyperparameter Optimization Algorithm," Indonesian Journal of Electrical Engineering and Informatics (IJEEI), vol. 12, no. 3, pp. 575–582, Sep. 2024.
A. Bahrami, M. Rakhshaninejad, R. Ghousi, and A. Atashi, "Enhancing machine learning performance in cardiac surgery ICU: Hyperparameter optimization with metaheuristic algorithm," PLOS ONE, vol. 20, no. 2, Feb. 2025, Art. no. e0311250.
R. H. Hridoy, A. D. Arni, S. K. Ghosh, N. R. Chakraborty, and I. Mahmud, "Performance enhancement of machine learning algorithm for breast cancer diagnosis using hyperparameter optimization," International Journal of Electrical and Computer Engineering (IJECE), vol. 14, no. 2, Apr. 2024, Art. no. 2181.
R. Sorano, K. S. N. Ripon, and L. V. Magnusson, "Evolutionary Multi-objective Optimization of Hyperparameters for Decision Support in Healthcare," in Handbook of Formal Optimization, A. J. Kulkarni and A. H. Gandomi, Eds. Singapore: Springer Nature Singapore, 2024, pp. 155–180.
E. C. Blessie, B. Sundaravadivazhagan, V. Kumutha, and V. Sumesh, "Predictive modeling of household power consumption using machine learning and meta-heuristic optimization technique," in Machine Learning for Radio Resource Management and Optimization in 5G and Beyond, 1st ed., Boca Raton: CRC Press, 2025, pp. 140–155.
T.-Y. Hong and C.-C. Chen, "Hyperparameter optimization for convolutional neural network by opposite-based particle swarm optimization and an empirical study of photomask defect classification," Applied Soft Computing, vol. 148, Nov. 2023, Art. no. 110904.
M. H. Amiri, N. Mehrabi Hashjin, M. Montazeri, S. Mirjalili, and N. Khodadadi, "Hippopotamus optimization algorithm: a novel nature-inspired optimization algorithm," Scientific Reports, vol. 14, no. 1, Feb. 2024, Art. no. 5032.
S. Vibhute, and C. Arage "A Novel Beagle Inspired Optimization Algorithm: Comprehensive Evaluation on Benchmarking Functions," Journal of Information Systems Engineering and Management, vol. 10, no. 35s, pp. 612–639, Apr. 2025.
H. Zhang, H. San, J. Chen, H. Sun, L. Ding, and X. Wu, "Black eagle optimizer: a metaheuristic optimization method for solving engineering optimization problems," Cluster Computing, vol. 27, no. 9, pp. 12361–12393, Dec. 2024.
J. Singh, J. K. Sandhu, and Y. Kumar, "Metaheuristic-based hyperparameter optimization for multi-disease detection and diagnosis in machine learning," Service Oriented Computing and Applications, vol. 18, no. 2, pp. 163–182, Jun. 2024.
Water Quality and Potability. (2023), L. Tharmalingam. [Online]. Available: https://www.kaggle.com/datasets/uom190346a/water-quality-and-potability.
Downloads
How to Cite
License
Copyright (c) 2025 Anupkumar Bongale, Amith C. Shekhar, Santoshkumar Biradar, Kavita Tukaram Patil, Yogeshwari V. Mahajan, Deepak Dharrao, Siddhaling Urolagin, P. Olof Olsson

This work is licensed under a Creative Commons Attribution 4.0 International License.
Authors who publish with this journal agree to the following terms:
- Authors retain the copyright and grant the journal the right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgement of the work's authorship and initial publication in this journal.
- Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the journal's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgement of its initial publication in this journal.
- Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) after its publication in ETASR with an acknowledgement of its initial publication in this journal.