Optimization of Support Vector Machine Parameters Using a Genetic Algorithm for Imbalanced Coffee Bean Classification Based on the CRISP-DM Methodology
Abstract
Coffee bean quality classification is a critical process in the agricultural industry, yet it faces significant challenges due to imbalanced data distributions that degrade standard classifiers such as Support Vector Machines (SVM). This study proposes an end-to-end machine learning framework following the CRISP-DM methodology to optimize SVM hyperparameters—specifically the penalty parameter (C) and kernel coefficient (γ)—using a continuous Genetic Algorithm (GA). A 32-dimensional visual feature extraction pipeline combining HSV color moments, RGB histograms, and grayscale texture statistics was engineered from 1,411 coffee bean images across five distinct classes (peaberry, longberry, premium, defect, and miscellaneous). To prevent data leakage, a stratified 5-fold cross-validation was implemented exclusively on 1,128 training samples to compute the cost-sensitive Macro F1-Score fitness function. The evolutionary search successfully identified optimal continuous parameters (C = 838.9254, γ = 0.0016). Experimental results on an independent holdout test set of 283 samples demonstrated that the proposed GA-SVM significantly outperformed the default baseline, elevating classification accuracy from 77.39% to 85.16% and the Macro F1-Score from 0.7742 to 0.8496. Notably, true positive detection for the commercially critical "defect" class rose from 38 to 52 instances, yielding a recall of 0.87 compared to 0.63 for the baseline. The optimized pipeline was deployed into a real-time Gradio web application featuring automated inference and Canny edge verification with latency under 150 ms, providing an accessible, interpretable decision support tool for small-scale agricultural processing facilities.
Article Discovery & Scholarly Lookup
DOIAuthor Biographies
Department of Engineering Informatics, Institut Teknologi Pagar Alam, Pagar Alam City, South Sumatra Province, Indonesia.
Department of Engineering Informatics, Institut Teknologi Pagar Alam, Pagar Alam City, South Sumatra Province, Indonesia
Department of Engineering Informatics, Institut Teknologi Pagar Alam, Pagar Alam City, South Sumatra Province, Indonesia
How to Cite
License & Copyright

This work is licensed under a Creative Commons Attribution 4.0 International License.
This is an open-access journal. All articles are distributed under the terms of the Creative Commons Attribution 4.0 International License (CC BY 4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.
Creative Commons Attribution 4.0 International (CC BY 4.0)Under this license, you are free to:
- Share: copy, distribute, and transmit the work in any medium or format.
- Adapt: remix, transform, and build upon the work for any purpose, even commercially.
You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
Copyright and Retention Copyright & Retention Authors retain copyright without restrictions and grant this journal the right of first publication under an open-access model. The journal retains non-exclusive publishing rights for archiving, indexing, and scholarly dissemination.References
Total: 23 References- Abert-Fernández, D., Monclús, H., Fetai, B., & Kozelj, D. (2026). AI-driven risk management for sustainable water distribution: A comparative study of resampling strategies and cost-sensitive predictive modeling for leakage failure. Water Research, 306, 126622. https://doi.org/10.1016/j.watres.2026.126622
- Ait Mehdi, M., Belattar, K., & Souami, F. (2024). Recent metaheuristic algorithms for medical object localization using MSER detector in computer-aided diagnosis system. Multimedia Tools and Applications, 84(15), 14433–14487. https://doi.org/10.1007/s11042-024-19606-w
- Al-Sabaawi, A. M. M., Ibrahim, A. A., & Al-Janabi, S. (2023). Hyperparameter tuning of Support Vector Machines using Genetic Algorithms for diagnostic medical imaging. Journal of Artificial Intelligence and Data Mining, 11(2), 215–226. https://doi.org/10.22044/jadm.2023.12541.1390
- Alves, J. V., Leitão, D., Jesus, S., Sampaio, M. O. P., Liébana, J., Saleiro, P., Figueiredo, M. A. T., & Bizarro, P. (2024). Cost-sensitive learning to defer to multiple experts with workload constraints. Transactions on Machine Learning Research, 2024, 1–32. https://arxiv.org/abs/2403.06906
- Arboleda, E. R. (2021). Classification of defective coffee beans using image processing and Random Forest algorithm. International Journal of Advanced Trends in Computer Science and Engineering, 10(1), 120–125. https://doi.org/10.30534/ijatcse/2021/181012021
Similar Articles
Explore related articles published in this journal.