Classification of Pistachio Varieties Using Metaheuristic Optimization: A Comparative Study

Authors

DOI:

https://doi.org/10.24925/turjaf.v14i9.2516-2527.9004

Keywords:

Pistachio , Machine learning, Metaheuristic optimization, Hyperparameter optimization, Classification

Abstract

This study addresses the classification of two commercially important pistachio varieties, Kirmizi and Siirt, cultivated extensively in Turkey. The objective is to evaluate the effectiveness of metaheuristic optimization for improving machine learning classifier performance in agricultural product discrimination. A dataset of 2148 images was used to extract 28 morphological, color, and texture features. Class imbalance was mitigated using the Synthetic Minority Over-sampling Technique. Logistic Regression, Support Vector Machine (SVM), and XGBoost classifiers were applied. Hyperparameters of these classifiers were optimized using six metaheuristic algorithms: Particle Swarm Optimization, Artificial Bee Colony, Swift Flight Optimizer, Tardigrade Optimization Algorithm, Bilby Optimization Algorithm (BOA), and Schrödinger Optimizer (SCO). Models were evaluated using 5-fold cross-validation on the training set and tested on an independent test set. Results indicate that BOA combined with SVM achieved the highest classification accuracy. The best discriminative power, measured by the area under the ROC curve, was obtained with SCO combined with XGBoost. Compared to default parameter configurations, metaheuristic optimization led to notable improvements in both SVM and XGBoost classifiers. The findings demonstrate that metaheuristic-based hyperparameter optimization provides an effective and competitive approach for automatic pistachio variety discrimination, offering practical potential for deployment in agricultural sorting and quality control systems.

References

Adegbenjo, A. O., & Ngadi, M. O. (2024). Handling the imbalanced problem in agri-food data analysis. Foods, 13(20), 3300. https://doi.org/10.3390/foods13203300

Aktaş, H. (2022). Antep fıstığının derin öğrenme ile dış kabuk rengine göre sınıflandırılması. Niğde Ömer Halisdemir Üniversitesi Mühendislik Bilimleri Dergisi, 11(3), 461-466. https://doi.org/10.28948/ngumuh.1064522

Bergstra, J., & Bengio, Y. (2012). Random search for hyper-parameter optimization. Journal of machine learning research, 13(2).

Blasco, J., Aleixos, N., & Molto, E. (2007). Computer vision detection of peel defects in citrus by means of a region oriented segmentation algorithm. Journal of Food engineering, 81(3), 535-543. https://doi.org/10.1016/j.jfoodeng.2006.12.007

Bülbül, H., Güler, E., & Yavuz, B. Ç. (2026). Machine Learning-Based Dual Agricultural Decision Support System: An Integrated Approach for Crop and Fertilizer Recommendations. Turkish Journal of Agriculture-Food Science and Technology, 14(1), 262-273. https://doi.org/10.24925/turjaf.v14i1.262-273.8336

Chawla, N. V., Bowyer, K. W., Hall, L. O., & Kegelmeyer, W. P. (2002). SMOTE: Synthetic minority over-sampling technique. Journal of Artificial Intelligence Research, 16, 321–357. https://doi.org/10.1613/jair.953

Cortes, C., & Vapnik, V. (1995). Support-vector networks. Machine learning, 20(3), 273-297. https://doi.org/10.1023/a:1022627411411

Dreher, M. L. (2012). Pistachio nuts: composition and potential health benefits. Nutrition reviews, 70(4), 234-240. https://doi.org/10.1111/j.1753-4887.2011.00467.x

Chen, T., & Guestrin, C. (2016, August). Xgboost: A scalable tree boosting system. In Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining (pp. 785-794).

Falkner, S., Klein, A., & Hutter, F. (2018). BOHB: Robust and efficient hyperparameter optimization at scale. In International conference on machine learning (pp. 1437-1446). PMLR.

FAO (2023, Nisan 23). FAOSTAT: Crops and Livestock Products. https://www.fao.org/faostat/en/ - data/QCL

Ferentinos, K. P. (2018). Deep learning models for plant disease detection and diagnosis. Computers and electronics in agriculture, 145, 311-318. https://doi.org/10.1016/j.compag.2018.01.009

Huang, C., Davis, L. S., & Townshend, J. R. G. (2002). An assessment of support vector machines for land cover classification. International Journal of remote sensing, 23(4), 725-749. https://doi.org/10.1080/01431160110040323

Hussein, N. K., Qaraad, M., El Najjar, A. M., Farag, M. A., Elhosseini, M. A., Mirjalili, S., & Guinovart, D. (2025). Schrödinger optimizer: A quantum duality-driven metaheuristic for stochastic optimization and engineering challenges. Knowledge-Based Systems, 328,114273. https://doi.org/10.1016/j.knosys.2025.114273

Karaboga, D. (2005). An idea based on honey bee swarm for numerical optimization (Technical Report TR06). Erciyes University.

Kareem, A. A., Abid, A. J., Hammood, D. A., Yaqoob, S. J., Husein, A., & Bereznychenko, V. (2025). Swift Flight Optimizer: a novel bio-inspired optimization algorithm based on swift bird behavior. Scientific Reports, 15(1), 41597.https://doi.org/10.1038/s41598-025-25490-7

Kennedy, J., & Eberhart, R. (1995). Particle swarm optimization. In Proceedings of ICNN'95-international conference on neural networks (Vol. 4, pp. 1942-1948). ieee. https://doi.org/10.1109/icnn.1995.488968

Kumar, S. S., Sigappi, A. N., Thomas, G. A. S., Robinson, Y. H., & Raja, S. P. (2023). Classification and Analysis of Pistachio Species Through Neural Embedding-Based Feature Extraction and Small-Scale Machine Learning Techniques. International Journal of Image and Graphics, 24(5), 2450032.https://doi.org/10.1142/s0219467824500323

Larochelle, H., Erhan, D., Courville, A., Bergstra, J., & Bengio, Y. (2007). An empirical evaluation of deep architectures on problems with many factors of variation. In Proceedings of the 24th international conference on Machine learning (pp. 473-480). https://doi.org/10.1145/1273496.1273556

LeCun, Y., Bengio, Y., & Hinton, G. (2015). Deep learning. nature, 521(7553), 436-444. https://doi.org/10.1038/nature14539

Leemans, V., Magein, H., & Destain, M. F. (2002). AE—automation and emerging technologies: on-line fruit grading according to their external quality using machine vision. Biosystems engineering, 83(4), 397-404. https://doi.org/10.1006/bioe.2002.0131

Liakos, K. G., Busato, P., Moshou, D., Pearson, S., & Bochtis, D. (2018). Machine learning in agriculture: a review. Sensors (Switzerland) 18 (8): 1–29. https://doi.org/10.3390/s18082674

Lima Marinho, T., do Nascimento, D. C., & Pimentel, B. A. (2024). Optimization on selecting XGBoost hyperparameters using meta‐learning. Expert Systems, 41(9), e13611. https://doi.org/10.1111/exsy.13611

Mahdavi-Jafari, S., Salehinejad, H., & Talebi, S. (2008). A pistachio nuts classification technique: An ann based signal processing scheme. In 2008 International Conference on Computational Intelligence for Modelling Control & Automation (pp. 447-451). IEEE. https://doi.org/10.1109/cimca.2008.150

Mehdary, A., Chehri, A., Jakimi, A., & Saadane, R. (2024). Hyperparameter optimization with genetic algorithms and XGBoost: a step forward in smart grid fraud detection. sensors, 24(4), 1230.https://doi.org/10.3390/s24041230

Mohanty, S. P., Hughes, D. P., & Salathé, M. (2016). Using deep learning for image-based plant disease detection. Frontiers in plant science, 7, 1419. https://doi.org/10.3389/fpls.2016.01419

Montazeri, Z., Dehghani, M., Smerat, A., Ismoilov, M., Zitar, R. A., Humod, A. T., & Eguchi, K. (2026). Bilby Optimization Algorithm (BOA): A Novel Bio-inspired Metaheuristic Algorithm for Solving Optimization Problems. International Journal of Intelligent Engineering and Systems, 19(4), 880-898. https://doi.org/10.22266/ijies2026.0430.50

Nandi, C. S., Tudu, B., & Koley, C. (2013). Machine vision based techniques for automatic mango fruit sorting and grading based on maturity level and size. In Sensing technology: current status and future trends II (pp. 27-46). Cham: Springer International Publishing. https://doi.org/10.1007/978-3-319-02315-1_2

Omid, M., Firouz, M. S., Nouri-Ahmadabadi, H., & Mohtasebi, S. S. (2017). Classification of peeled pistachio kernels using computer vision and color features. Engineering in agriculture, environment and food, 10(4), 259-265. https://doi.org/10.1016/j.eaef.2017.04.002

Ozkan, I. A., Koklu, M., & Saracoglu, R. (2021). Classification of Pistachio Species Using Improved k-NN Classifier. Progress in Nutrition, 23(2), e2021044. https://doi.org/10.23751/pn.v23i2.9686

Probst, P., Boulesteix, A. L., & Bischl, B. (2019). Tunability: Importance of hyperparameters of machine learning algorithms. Journal of Machine Learning Research, 20(53), 1-32.

Qanith, M., & Khilar, R. (2025). Improving accuracy for recommending the appropriate crop using random forest in comparison with logistic regression. AIP Conference Proceedings, 3267(1), 020270. https://doi.org/10.1063/5.0265122

Raihen, M. N., & Akter, S. (2023). Prediction modeling using deep learning for the classification of grape-type dried fruits. International Journal of Mathematics and Computer in Engineering, 2(1), 1-12. https://doi.org/10.2478/ijmce-2024-0001

Rizkallah, L. W. (2025). Optimizing SVM hyperparameters for satellite imagery classification using metaheuristic and statistical techniques. International Journal of Data Science and Analytics, 20(5), 4945-4962.https://doi.org/10.1007/s41060-025-00762-7

Vapnik, V. (2013). The nature of statistical learning theory. Springer science & business media. https://doi.org/10.1007/978-1-4757-3264-1

Saranwong, S., Sornsrivichai, J., & Kawano, S. (2004). Prediction of ripe-stage eating quality of mango fruit from its harvest quality measured nondestructively by near infrared spectroscopy. Postharvest biology and technology, 31(2), 137-145. https://doi.org/10.1016/j.postharvbio.2003.08.007

Şimşek, F. F. (2025). Comparison of agricultural crop type classifications with different machine learning algorithms (RF-SVM-ANN-XGBoost) by generating ground truth data from farmer declaration parcels. International Journal of Engineering and Geosciences, 10(2), 207-220. https://doi.org/10.26833/ijeg.1552141

Singh, D., Taspinar, Y. S., Kursun, R., Cinar, I., Koklu, M., Ozkan, I. A., & Lee, H. N. (2022). Classification and analysis of pistachio species with pre-trained deep learning models. Electronics, 11(7), 981. https://doi.org/10.3390/electronics11070981

Snoek, J., Larochelle, H., & Adams, R. P. (2012). Practical bayesian optimization of machine learning algorithms. Advances in neural information processing systems, 25.

Sonmez, M. E., Sabanci, K., & Aydin, N. (2024). Convolutional neural network-support vector machine-based approach for identification of wheat hybrids. European Food Research and Technology, 250(5), 1353-1362. https://doi.org/10.1007/s00217-024-04473-4

Turkay, Y., & Tamay, Z. S. (2024). Pistachio classification based on acoustic systems and machine learning. Elektronika Ir Elektrotechnika, 30(5), 4-13. https://doi.org/10.5755/j02.eie.38221

Uzer, M. S. (2025). Deep Learning-Based Classification Consisting of Pre-Trained Models and Proposed Model Using K-Fold Cross-Validation for Pistachio Species. Applied Sciences, 15(8), 4516. https://doi.org/10.3390/app15084516

Vidyarthi, S. K., Tiwari, R., Singh, S. K., & Xiao, H. W. (2020). Prediction of size and mass of pistachio kernels using random Forest machine learning. Journal of Food Process Engineering, 43(9), e13473. https://doi.org/10.1111/jfpe.13473

Wei, Y., Qiu, X., Peng, Z., Wu, Y., Min, W., & Xu, T. (2025). Network-regularized sparse logistic regression for crop identification in remote sensing images. Journal of Applied Remote Sensing, 19(2), 028505-028505. https://doi.org/10.1117/1.jrs.19.028505

Wolpert, D. H., & Macready, W. G. (1997). No free lunch theorems for optimization. IEEE Transactions on Evolutionary Computation, 1(1), 67–82. https://doi.org/10.1109/4235.585893

Yang, L., & Shami, A. (2020). On hyperparameter optimization of machine learning algorithms: Theory and practice. Neurocomputing, 415, 295-316. https://doi.org/10.1016/j.neucom.2020.07.061

Yao, J., Dou, J., Chen, K., Li, J., Luo, X., Wang, J., & Ren, M. (2026). A tardigrade-inspired metaheuristic algorithm for complex multimodal optimization and high-dimensional applications. Neurocomputing, 668, 132380. https://doi.org/10.1016/j.neucom.2025.132380

Downloads

Published

17.09.2026

How to Cite

Özarslan, A. (2026). Classification of Pistachio Varieties Using Metaheuristic Optimization: A Comparative Study. Turkish Journal of Agriculture - Food Science and Technology, 14(9), 2516–2527. https://doi.org/10.24925/turjaf.v14i9.2516-2527.9004

Issue

Section

Research Paper