Explainable Machine Learning for Food Allergen Detection Using Tree-Based Ensembles
DOI:
https://doi.org/10.55537/cosie.v5i4.1986Keywords:
Food Allergens, Machine Learning, Classification, Explainable AI, SHAPAbstract
Food product allergen annotations are relevant to ingredient-related classification, although dataset-label prediction must be distinguished from laboratory-confirmed allergen detection. This study compares four tree-based machine learning models XGBoost, AdaBoost, Decision Tree, and Random Forest using a secondary food ingredient dataset containing 399 records from Kaggle. An 80:20 training–testing split was used, and models were assessed using accuracy, precision, recall, and F1-score. In the reported 80-record test set, Random Forest achieved the highest accuracy (0.86), with a class-1 F1-score of 0.91, a macro-average F1-score of 0.82, and class-0 recall of 0.65. SHapley Additive exPlanations (SHAP) were used to interpret Random Forest predictions; fat/oil attributes, including olive oil and butter, were prominent model-associated features. These associations describe patterns learned from the dataset rather than causal or biologically verified effects. The findings should be viewed as preliminary, dataset-specific classification results; external validation and additional evaluation are required before any food-safety application
Downloads
References
[1] S. H. Sicherer and H. A. Sampson, “Food allergy,” J. Allergy Clin. Immunol., vol. 125, no. 2, pp. S116–S125, Feb. 2010, doi: 10.1016/j.jaci.2009.08.028.
[2] V. Sampath et al., “Food allergy across the globe,” J. Allergy Clin. Immunol., vol. 148, no. 6, pp. 1347–1364, Dec. 2021, doi: 10.1016/j.jaci.2021.10.018.
[3] W. A. Żukiewicz-Sobczak, P. Wróblewska, P. Adamczuk, and P. Kopczyński, “Causes, symptoms and prevention of food allergy,” Adv. Dermatol. Allergol., vol. 2, pp. 113–116, 2013, doi: 10.5114/pdia.2013.34162.
[4] S. R. Nimmagadda and R. Evans, “Allergy: Etiology and Epidemiology,” Pediatr. Rev., vol. 20, no. 4, pp. 110–116, Apr. 1999, doi: 10.1542/pir.20-4-110.
[5] B. K. Ballmer-Weber, “Value of Allergy Tests for the Diagnosis of Food Allergy,” Dig. Dis., vol. 32, no. 1–2, pp. 84–88, 2014, doi: 10.1159/000357077.
[6] L. Wang, D. Niu, X. Zhao, X. Wang, M. Hao, and H. Che, “A Comparative Analysis of Novel Deep Learning and Ensemble Learning Models to Predict the Allergenicity of Food Proteins,” Foods, vol. 10, no. 4, p. 809, Apr. 2021, doi: 10.3390/foods10040809.
[7] H. Shaukat, A. Sultan, and H. Salahuddin, “Enhancing Food Safety: A Machine Learning Approach for Accurate Detection and Classification of Food Allergens.”
[8] T. Arima et al., “Prediction of oral food challenge outcome using machine learning methods,” J. Allergy Clin. Immunol., vol. 155, no. 2, p. AB258, Feb. 2025, doi: 10.1016/j.jaci.2024.12.798.
[9] Siska Narulita, Sekarlangit Sekarlangit, and Milka Putri Novianingrum, “Deteksi Alergen pada Produk Pangan Menggunakan Algoritma Support Vector Machines (SVM),” Bridge J. Publ. Sist. Inf. Dan Telekomun., vol. 3, no. 1, pp. 64–76, Feb. 2025, doi: 10.62951/bridge.v3i1.393.
[10] P. Sharma, M. T. Siddiqi, S. Agarwal, K. Kaur, and K. G, “Food Allergen Detection and Recommendation,” SSRN Electron. J., 2025, doi: 10.2139/ssrn.5198646.
[11] M. Nedyalkova, M. Vasighi, A. Azmoon, L. Naneva, and V. Simeonov, “Sequence-Based Prediction of Plant Allergenic Proteins: Machine Learning Classification Approach,” ACS Omega, vol. 8, no. 4, pp. 3698–3704, Jan. 2023, doi: 10.1021/acsomega.2c02842.
[12] Junaid Ahmad et al., “UTILIZING DEEP LEARNING TECHNIQUES FOR DETECTING AND ANALYZING FOOD ALLERGIES,” Kashf J. Multidiscip. Res., vol. 2, no. 03, pp. 46–60, Mar. 2025, doi: 10.71146/kjmr332.
[13] J. Zhang et al., “Prediction of oral food challenge outcomes via ensemble learning,” Inform. Med. Unlocked, vol. 36, p. 101142, 2023, doi: 10.1016/j.imu.2022.101142.
[14] O. O. Bifarin, “Interpretable machine learning with tree-based shapley additive explanations: Application to metabolomics datasets for binary classification,” PloS One, vol. 18, no. 5, p. e0284315, 2023, doi: 10.1371/journal.pone.0284315.
[15] V. Borisov, T. Leemann, K. Seßler, J. Haug, M. Pawelczyk, and G. Kasneci, “Deep Neural Networks and Tabular Data: A Survey,” 2021, doi: 10.48550/ARXIV.2110.01889.
[16] L. Tharmalingam, “Food Ingredients And Allergens.” Accessed: May 05, 2025. [Online]. Available: https://www.kaggle.com/datasets/uom190346a/food-ingredients-and-allergens/data
[17] Y.-Y. Song and Y. Lu, “Decision tree methods: applications for classification and prediction,” Shanghai Arch. Psychiatry, vol. 27, no. 2, pp. 130–135, Apr. 2015, doi: 10.11919/j.issn.1002-0829.215044.
[18] M. Pal, “Random forest classifier for remote sensing classification,” Int. J. Remote Sens., vol. 26, no. 1, pp. 217–222, Jan. 2005, doi: 10.1080/01431160412331269698.
[19] P. Zhang, Y. Jia, and Y. Shang, “Research and application of XGBoost in imbalanced data,” Int. J. Distrib. Sens. Netw., vol. 18, no. 6, p. 155013292211069, Jun. 2022, doi: 10.1177/15501329221106935.
[20] Y. Cao, Q.-G. Miao, J.-C. Liu, and L. Gao, “Advance and Prospects of AdaBoost Algorithm,” Acta Autom. Sin., vol. 39, no. 6, pp. 745–758, Jun. 2013, doi: 10.1016/S1874-1029(13)60052-X.
[21] F. Pedregosa et al., “Scikit-learn: Machine Learning in Python,” Mach. Learn. PYTHON.
[22] G. Naidu, T. Zuva, and E. M. Sibanda, “A Review of Evaluation Metrics in Machine Learning Algorithms,” in Artificial Intelligence Application in Networks and Systems, vol. 724, R. Silhavy and P. Silhavy, Eds., Cham: Springer International Publishing, 2023, pp. 15–25. doi: 10.1007/978-3-031-35314-7_2.
[23] L. Arrighi, I. A. de Moraes, M. Zullich, M. Simonato, D. F. Barbin, and S. B. Junior, “Explainable Artificial Intelligence Techniques for Interpretation of Food Models: a Review,” 2025, arXiv. doi: 10.48550/ARXIV.2504.10527.
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 Bakti Amirul Jabar, Martin Halim, Richard Edsel Wijaya, Hansel Mitchell Tumanggor

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.



