Ensemble Learning Models for Food Safety Risk Prediction
Abstract
:1. Introduction
2. Literature Review
2.1. Machine Learning and Ensemble Learning
2.2. Advantages of Ensemble Learning
- Ability to process a large training dataset. When there is a large amount of data in the training dataset, using a single classification algorithm to train classification models may result in training processes that are inefficient and time consuming. Using an ensemble learning method, a large training dataset can be divided into multiple training data subsets, which can be separately trained using classification algorithms to produce different classification models. The outputs of these classification models can then be combined to obtain the overall inference.
- Allows processing of imbalanced data. During classification model training, an excessively small number of instances in minority classes often causes data imbalance, which creates biases and ultimately results in misclassification. Resampling can be performed to increase the number of instances in these minority classes, although this creates different balanced datasets, which can be trained separately using classification algorithms to produce different classification models. Alternatively, different classification algorithms can be used to establish classification models with greater diversity, and larger weights can be assigned to minority classes. Moreover, the prediction results of the aforementioned classification models can be combined using an ensemble learning method to reduce the effects of data imbalance and enhance classification performance for minority classes.
- Enhancement of linear classification model performance. Nonlinear classification problems cannot be effectively solved using linear classification learning algorithms. With ensemble learning methods, multiple linear classification models can be combined to obtain nonlinear decision boundaries between samples of different classes.
- Enables fusion of heterogenous data. Ensemble learning can be used to fuse heterogeneous datasets and characteristic data. In the present study, random quality inspections were performed on each batch of imported food products with the aim of predicting quality conformity or non-conformity using the data of each selected declared batch of products. The dataset of each batch contains highly diverse data, including basic vendor data, records of non-conformity during previous inspections, previous imported items, basic data of manufacturers at the source of imported items, non-conformities during post-market inspections in Taiwan, and international product recall alerts; the various datasets also contain different characteristics. Therefore, when inspections are performed on batches in which non-conformity is more likely to occur, it is not possible to achieve direct training of classification models based on the aforementioned heterogeneous datasets and characteristics information. To address this issue, we separately trained individual classification models and subsequently combined the models using ensemble learning to obtain the overall inference result.
2.3. Principles of Ensemble Learning
2.4. Applications of Ensemble Learning in Food Management
2.5. Bagging (Bootstrap Aggregating) Classification
3. Materials and Methods
3.1. Data Sources and Tools
3.2. Study Process
3.2.1. Data Collection
3.2.2. Data Integration and Preprocessing
3.2.3. Construction of Risk Prediction Models
Risk Characteristic Factor Selection
Splitting of Data into Training, Validation, and Test Datasets
Data Mining and Modeling
Resampling for Training Dataset
Iterative Modeling
Selection of Optimum Model
- The accuracy rate (ACR) measures the overall discriminatory power of the model toward samples, i.e., the ability to classify conforming samples as conforming and non-conforming samples as non-conforming. However, an imbalance was present in the samples of the present study because of the smaller number of non-conformities in our data. Therefore, ACR may reflect a tendency toward the prediction of conformities because of the stronger discriminatory power toward conformity. To address this issue, greater emphasis was placed on Recall and PPV during the evaluation of model performance. ACR was calculated using Equation (1):ACR = (TP + TN) / (TP + TN + FP + FN)
- Recall or sensitivity is the proportion of samples correctly classified as non-conforming among all the samples that are actually non-conforming, as shown in Equation (2):Recall = TP / (FN + TP)
- Positive predictive value (PPV) or precision is the proportion of samples that are actually non-conforming among all the samples classified as non-conforming by the model, i.e., the non-conformity hit rate. PPV was calculated using Equation (3):PPV = TP / (TP + FP)
- F1 score, defined as the harmonic mean of Recall and PPV, is particularly important when working with imbalanced data. In the present study, model performance was estimated using the F1 score by assuming that the PPV and F1 thresholds were 0.5, i.e., equal weights were assigned. Larger F1 scores are indicative of higher TP values. The F1 score was calculated using Equation (4):F1 = 2(PPV × Recall) / (PPV + Recall) = 2TP / (2TP + FP + FN)
- Area under the receiver operating characteristics (ROC) curve (AUC) is a measure of the classification accuracy of the model; a larger AUC indicates higher accuracy. AUC = 1 denotes a perfect classifier, 0.5 < AUC < 1 indicates that the model is superior to random guessing, AUC = 0.5 indicates that the model is comparable to random guessing and does not possess classification ability, and AUC < 0.5 denotes a classifier inferior to random guessing.
3.2.4. Evaluation of Predictive Performance
4. Results
4.1. Processing Methods for Imbalanced Samples and Optimum Conformity: Non-Conformity Ratio
- Set a value for the required amount of oversampling (N), which represents the number of samples to be synthesized for each sample.
- Set a value for the number of nearest neighbors to be considered (K), determine the K nearest neighbors, and randomly select one sample from these K neighboring samples.
- Generate N samples using Equation (5):
4.2. Optimum Number of Modeling Iterations
4.3. Optimum Prediction Model
4.3.1. Optimum Data Combinations
- The optimum combination for class A was Scale-up/2011–2017 data/inclusion of blacklisted vendors, and the values of the predictive performance indicators were ACR = 86.6%, F1 score = 48.0%, PPV = 55.3%, and Recall = 42.4%.
- The optimum combination for class B was SMOTE/2011–2017 data/inclusion of blacklisted vendors, and the values of the predictive performance indicators were ACR = 93.9%, F1 score = 18.5%, PPV = 11.4%, and Recall = 48.0%.
- The optimum combination for class C was Scale-up/2011–2017 data/inclusion of blacklisted vendors, and the values of the predictive performance indicators were ACR = 94.4%, F1 score = 22.0%, PPV = 24.5%, and Recall = 19.9%.
4.3.2. Generation of Optimum Prediction Model
4.3.3. Model predictive performance
5. Discussion
5.1. Comparison of Single Algorithms with Ensemble Learning
5.2. Evaluation of Model Performance after Online Implementation
5.3. Learning Feedback Mechanisms
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Acknowledgments
Conflicts of Interest
References
- Bouzembrak, Y.; Marvin, H.J.P. Prediction of Food Fraud Type Using Data from Rapid Alert System for Food and Feed (RASFF) and Bayesian Network Modelling. Food Control 2016, 61, 180–187. [Google Scholar] [CrossRef]
- Marvin, H.J.P.; Janssen, E.M.; Bouzembrak, Y.; Hendriksen, P.J.M.; Staats, M. Big Data in Food Safety: An Overview. Crit. Rev. Food Sci. Nutr. 2017, 57, 2286–2295. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- United States Government Accountability Office. Imported Food Safety: FDA’s Targeting Tool has Enhanced Screening, But Further Improvements are Possible; GAO: Washington, DC, USA, May 2016. Available online: https://www.gao.gov/products/gao-16-399 (accessed on 1 November 2021).
- Wolpert, D.H. The Supervised Learning No-free-lunch Theorems. In Soft Computing and Industry: Recent Application; Roy, R., Koppen, M., Ovaska, S., Furuhashi, T., Hoffmann, F., Eds.; Springer: London, UK, 2002; pp. 25–42. [Google Scholar]
- Pagano, C.; Granger, E.; Sabourin, R.; Gorodnichy, D.O. Detector Ensembles for Face Recognition in Video Surveillance. In Proceedings of the International Joint Conference on Neural Networks (IJCNN), Brisbane, Australia, 10–15 June 2012; pp. 1–8. [Google Scholar] [CrossRef] [Green Version]
- Pintelas, P.; Livieris, I.E. Special Issue on Ensemble Learning and Applications. Algorithms 2020, 13, 140. [Google Scholar] [CrossRef]
- Dasarathy, B.V.; Sheela, B.V.A. Composite Classifier System Design: Concepts and methodology. Proc. IEEE Inst. Electr. Electron. Eng. 1979, 67, 708–713. [Google Scholar] [CrossRef]
- Hansen, L.K.; Salamon, P. Neural network ensembles. IEEE Trans. Pattern Anal. Mach. Intell. 1990, 12, 993–1001. [Google Scholar] [CrossRef] [Green Version]
- Polikar, R. Ensemble Based Systems in Decision Making. IEEE Circuits Syst. Mag. 2006, 6, 21–45. [Google Scholar] [CrossRef]
- Suganyadevi, K.; Malmurugan, N.; Sivakumar, R. OF-SMED: An Optimal Foreground Detection Method in Surveillance System for Traffic Monitoring. In Proceedings of the International Conference on Cyber Security, Cyber Warfare and Digital Forensic, CyberSec, Kuala Lumpur, Malaysia, 26–28 June 2012; pp. 12–17. [Google Scholar] [CrossRef]
- Wang, R.; Bunyak, F.; Seetharaman, G.; Palaniappan, K. Static and Moving Object Detection Using Flux Tensor with Split Gaussian Models. In Proceeding of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, Columbus, OH, USA, 23–28 June 2014; pp. 414–418. [Google Scholar] [CrossRef]
- Wang, T.; Sonoussi, H. Detection of Abnormal Visual Events via Global Optical Flow Orientation Histogram. IEEE Trans. Inf. Forensics Secur. 2014, 9, 998. [Google Scholar] [CrossRef]
- Tsai, C.J. New feature selection and voting scheme to improve classification accuracy. Soft Comput. 2019, 23, 12017–12030. [Google Scholar] [CrossRef]
- Cao, P.; Zhao, D.; Zaiane, O. Hybrid probabilistic sampling with random subspace for imbalanced data learning. Intell. Data Anal. 2014, 18, 1089–1108. [Google Scholar] [CrossRef] [Green Version]
- Feng, L.; Zhang, Z.; Ma, Y.; Du, Q.; Williams, P.; Drewry, J.; Luck, B. Alfalfa Yield Prediction Using UAV-Based Hyperspectral Imagery and Ensemble Learning. Remote Sens. 2020, 12, 2028. [Google Scholar] [CrossRef]
- Parastar, H.; van Kollenburg, G.; Weesepoel, Y.; van den Doel, A.; Buydens, L.; Jansen, J. Integration of Handheld NIR and Machine Learning to “Measure & Monitor” Chicken Meat Authenticity. Food Control 2020, 112, 1–11. [Google Scholar] [CrossRef]
- Neto, H.A.; Tavares, W.L.F.; Ribeiro, D.C.S.Z.; Alves, R.C.O.; Fonseca, L.M.; Campos, S.V.A. On the Utilization of Deep and Ensemble Learning to Detect Milk Adulteration. BioData Min. 2019, 12, 1–13. [Google Scholar] [CrossRef]
- Breiman, L. Bagging Predictors. In Technical Report No. 421; University of California: Oakland, CA, USA, September 1994; Available online: http://www.cs.utsa.edu/~bylander/cs6243/breiman96bagging.pdf (accessed on 10 November 2020).
- Lin, M.K. Visitant: A Structured Agent-Based Peer-to-Peer System. Master’s Thesis, Graduate Institute of Information Management, National Taiwan University, Taipei, Taiwan, 2004. [Google Scholar]
- Tang, Z.K.; Zheng, J.S.; Wang, W.Z. The Phase Sequence-changeable Control based on Fuzzy Neural Network of Isolated Intersection. J. Zhejiang Vocat. Tech. Inst. Transp. 2014, 7, 29–32. [Google Scholar]
- Hsieh, Y.S. Using Discharge Summary to Determine the International Classification of Diseases-9th Revision-Clinical Modification. Master’s Thesis, Graduate School of Information Management, National Yunlin University of Science and Technology, Yunlin, Taiwan, 2007. [Google Scholar]
- Mbogning, C.; Broet, P. Bagging Survival Tree Procedure for Variable Selection and Prediction in the Presence of Nonsusceptible Patients. BMC Bioinform. 2016, 17, 230. [Google Scholar] [CrossRef] [PubMed] [Green Version]
- Kieu, L.M.; Ou, Y.; Truong, L.T.; Cai, C. A Class-specific Soft Voting Framework for Customer Booking Prediction in On-demand Transport. Transp. Res. Part C Emerg. Technol. 2020, 114, 377–390. [Google Scholar] [CrossRef]
- Mosavi, A.; Hosseini, F.S.; Choubin, B.; Goodarzi, M.; Dineva, A.A.; Sardooi, E.R. Ensemble Boosting and Bagging Based Machine Learning Models for Groundwater Potential Prediction. Water Resour. Manag. 2021, 35, 23–37. [Google Scholar] [CrossRef]
Type | Factors | Data Sources | |
---|---|---|---|
Taiwan Food Cloud | Information on International Public Opinion and Product Recall Alerts | ||
Product | Value, net weight, inspection methods, blacklisted products, packaging methods, validity period, products for which international recall alerts have been issued, manufacturing date, expiry date, etc. | Data of border inspections Product inspection and testing data Product alerts | United States Food and Drug Administration (US FDA) https://www.fda.gov Food Safety and Inspection Service (FSIS) of the US Department of Agriculture (USDA) https://www.fsis.usda.gov Rapid Alert System for Food and Feed (RASFF) of the European Union https://ec.europa.eu/food/safety/rasff_en Canadian Food Inspection Agency (CFIA) http://inspection.gc.ca Food Standards Agency (FSA) of the United Kingdom https://www.food.gov.uk Food Safety Authority of Ireland (FSAI) https://www.fsai.ie Food Standards Australia New Zealand (FSANZ) http://www.foodstandards.gov.au Consumer Affairs Agency (CAA) of Japan https://www.recall.caa.go.jp Singapore Food Agency (SFA) https://www.sfa.gov.sg China Food and Drug Administration (CFDA) http://gkml.samr.gov.cn Foodmate Network of China http://news.foodmate.net Centre for Food Safety (CFS) of Hong Kong http://www.cfs.gov.hk |
Border inspection | Transportation time, month of inspection, quarter of inspection, year of inspection, method of transportation, agent importation, re-exportation, customs district, etc. | Management data of border inspections | Nil |
Customs broker | Number of declarations filed, number of border inspection cancellations, number of days from the previous importation, rate of change of number of days taken for importation, number of cases of non-conforming labels and external appearances, number of batches forfeited or returned, number of inspections, number of failed inspections, number of failed document reviews, number of product classes, etc. | Food company registration data Data of border inspections Business registration data | Nil |
Importer | Capital, years of establishment, number of branches, number of downstream vendors, number of company registration changes, number of late deliveries, sole focus on importation (yes/no), number of lines of businesses, new company (yes/no), district of registration, branch company (yes/no), blacklisted importer (yes/no), county/city, number of preliminary inspections, GHP inspections, HACCP inspections, label inspections, product inspections, number of lines of food businesses, factory registration (yes/no), delayed declaration of goods receipt/delivery (yes/no), interval between importations, variations in the interval between importations, variations in the number of days taken for importation, variations in total net weight, number of declarations filed, number of cases of non-conforming Chinese labels and external appearances, value, net weight, number of non-releases, number of batches detained, forfeited or returned, number of failed inspections, number of inspections, number of failed document reviews, number of border inspection cancellations, number of manufacturers, number of product classes for which declarations have been filed, total number of classes, etc. | Food company registration data Data of border inspections Product inspection and testing data Product flow data Business registration data | Nil |
Manufacturer | Trademarks, interval between importations, rate of change of interval between importations, internationally alerted manufacturer (yes/no), internationally alerted brand (yes/no), number of cases of non-conforming Chinese labels and external appearances, number of batches detained, forfeited or returned, number of failed inspections, number of inspections, number of failed document reviews, number of declarations filed, number of border inspection cancellations, number of importers, number of product classes, etc. | Food company registration data Data of border inspections Product inspection and testing data Product alerts | USFDA https://www.fda.gov FSIS https://www.fsis.usda.gov CFIA http://inspection.gc.ca FSA https://www.food.gov.uk RASFF https://ec.europa.eu/food/safety/rasff_en FSAI https://www.fsai.ie FSANZ http://www.foodstandards.gov.au CAA https://www.recall.caa.go.jp SFA https://www.sfa.gov.sg CFDA http://gkml.samr.gov.cn Foodmate Network of China http://news.foodmate.net CFS http://www.cfs.gov.hk |
Country of manufacture | Country of manufacture of products subjected to inspection | Data of border inspections | Nil |
GDP, economic growth rate, GFSI, CPI, HDI, LRI, regional PRI | Nil | https://data.oecd.org/gdp/gross-domestic-product-gdp.htm https://www.imf.org/en/Publications https://foodsecurityindex.eiu.com/ https://www.transparency.org/en/cpi/2020/index/nzl http://hdr.undp.org/en/2020-report https://data.worldbank.org/indicator/IC.LGL.CRED.XQ https://www.prsgroup.com/regional-political-risk-index/ |
Entry Type | Definition |
---|---|
True Positive (TP) | Predicted border inspection result for the product batch by model classification: non-conforming; actual inspection result: non-conforming |
False Positive (FP) | Predicted border inspection result for the product batch by model classification: non-conforming; actual inspection result: conforming |
True Negative (TN) | Predicted border inspection result for the product batch by model classification: conforming; actual inspection result: conforming |
False Negative (FN) | Predicted border inspection result for the product batch by model classification: conforming; actual inspection result: non-conforming |
Resampling Method and Ratio * Adopted for Processing Imbalanced Data | Class A | Class B | Class C | ||||||
---|---|---|---|---|---|---|---|---|---|
PPV | Recall | F1 | PPV | Recall | F1 | PPV | Recall | F1 | |
SMOTE 7:3 | 25.08% | 65.25% | 0.3624 | 2.24% | 88.64% | 0.0437 | 7.25% | 65.73% | 0.1307 |
SMOTE 6:4 | 24.28% | 71.19% | 0.3621 | 1.92% | 100.00% | 0.0376 | 6.35% | 71.35% | 0.1166 |
SMOTE 5:5 | 22.92% | 74.58% | 0.3506 | 1.82% | 100.00% | 0.0357 | 5.75% | 74.16% | 0.1067 |
SMOTE 4:6 | 20.43% | 79.66% | 0.3253 | 1.49% | 100.00% | 0.0293 | 5.26% | 79.21% | 0.0986 |
SMOTE 3:7 | 18.82% | 83.90% | 0.3075 | 1.40% | 100.00% | 0.0276 | 4.74% | 84.27% | 0.0898 |
Scale-up 7:3 | 15.48% | 95.76% | 0.2665 | 2.07% | 81.82% | 0.0405 | 3.60% | 93.82% | 0.0693 |
Combination No. | Data Interval (year) | Inclusion/Non-Inclusion of Blacklisted Vendors | Resampling Method for Data Imbalance * |
---|---|---|---|
I | 2011–2017 | Non-inclusion | Scale-up |
II | 2011–2017 | Non-inclusion | SMOTE |
III | 2011–2017 | Inclusion | Scale-up |
IV | 2011–2017 | Inclusion | SMOTE |
V | 2016–2017 | Inclusion | Scale-up |
VI | 2016–2017 | Inclusion | SMOTE |
Dataset | Product Class | Data/Resampling Method Combination | ACR | Recall | PPV | NPV | F1 | AUC | TN | FP | TP | FN |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Validation dataset | A | P_11_non-inclusion | 83.2% | 36.4% | 41.4% | 89.3% | 38.7% | 74.7% | 528 | 51 | 36 | 63 |
P_11_inclusion | 86.6% | 42.4% | 55.3% | 90.5% | 48.0% | 78.3% | 545 | 34 | 42 | 57 | ||
P_16_inclusion | 85.0% | 25.3% | 47.2% | 88.2% | 32.9% | 76.7% | 551 | 28 | 25 | 74 | ||
S_11_non-inclusion | 82.3% | 44.4% | 40.4% | 90.3% | 42.3% | 74.1% | 514 | 65 | 44 | 55 | ||
S_11_ inclusion | 84.8% | 39.4% | 47.6% | 89.9% | 43.1% | 76.6% | 536 | 43 | 39 | 60 | ||
S_16_ inclusion | 83.9% | 44.4% | 44.9% | 90.5% | 44.7% | 75.0% | 525 | 54 | 44 | 55 | ||
B | P_11_non-inclusion | 91.2% | 12.0% | 2.2% | 98.6% | 3.8% | 72.3% | 1584 | 131 | 3 | 22 | |
P_11_ inclusion | 94.8% | 40.0% | 11.6% | 99.1% | 18.0% | 79.3% | 1639 | 76 | 10 | 15 | ||
P_16_ inclusion | 95.8% | 20.0% | 8.6% | 98.8% | 12.0% | 75.9% | 1662 | 53 | 5 | 20 | ||
S_11_non-inclusion | 93.9% | 12.0% | 3.4% | 98.7% | 5.3% | 71.1% | 1630 | 85 | 3 | 22 | ||
S_11_ inclusion | 93.9% | 48.0% | 11.4% | 99.2% | 18.5% | 81.1% | 1622 | 93 | 12 | 13 | ||
S_16_ inclusion | 94.5% | 36.0% | 10.2% | 99.0% | 15.9% | 76.2% | 1636 | 79 | 9 | 16 | ||
C | P_11_non-inclusion | 94.1% | 14.0% | 18.1% | 96.5% | 15.8% | 65.9% | 3237 | 86 | 19 | 117 | |
P_11_ inclusion | 94.4% | 19.9% | 24.5% | 96.7% | 22.0% | 67.2% | 3240 | 83 | 27 | 109 | ||
P_16_ inclusion | 92.7% | 25.7% | 18.7% | 96.9% | 21.7% | 68.2% | 3171 | 152 | 35 | 101 | ||
S_11_non-inclusion | 88.1% | 20.6% | 8.5% | 96.5% | 12.0% | 62.9% | 3020 | 303 | 28 | 108 | ||
S_11_ inclusion | 87.7% | 19.1% | 7.6% | 96.5% | 10.9% | 62.9% | 3007 | 316 | 26 | 110 | ||
S_16_ inclusion | 81.4% | 21.3% | 5.1% | 96.3% | 8.3% | 59.7% | 2785 | 538 | 29 | 107 |
No. | Dataset | Product Class | Data/Resampling Method Combination | Algorithm | ACR | Recall | PPV | NPV | F1 | AUC | TN | FP | TP | FN |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A1 | Validation dataset | A | P_11_Inclusion | Bagging-CART | 86.1% | 55.6% | 52.4% | 92.3% | 53.9% | 77.5% | 529 | 50 | 55 | 44 |
A2 | P_11_Inclusion | Bagging-C5.0 | 86.1% | 45.5% | 52.9% | 90.9% | 48.9% | 76.4% | 539 | 40 | 45 | 54 | ||
A3 | P_11_Inclusion | Bagging-Logistic | 86.3% | 43.4% | 53.8% | 90.6% | 48.0% | 70.3% | 542 | 37 | 43 | 56 | ||
A4 | P_11_Inclusion | Ensemble learning | 86.6% | 42.4% | 55.3% | 90.5% | 48.0% | 78.3% | 545 | 34 | 42 | 57 | ||
A5 | P_11_Inclusion | Bagging-NB | 80.8% | 59.6% | 39.6% | 92.4% | 47.6% | 77.3% | 489 | 90 | 59 | 40 | ||
A6 | P_11_Inclusion | Bagging-RF | 86.6% | 36.4% | 56.3% | 89.7% | 44.2% | 79.0% | 551 | 28 | 36 | 63 |
No. | Dataset | Product Class | Data/Resampling Method Combination | Algorithm | ACR | Recall | PPV | NPV | F1 | AUC | TN | FP | TP | FN |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
B1 | Validation dataset | B | S_11_Inclusion | Bagging-Logistic | 94.0% | 48.0% | 11.5% | 99.2% | 18.6% | 78.0% | 1623 | 92 | 12 | 13 |
B2 | S_11_Inclusion | Ensemble learning | 93.9% | 48.0% | 11.4% | 99.2% | 18.5% | 81.1% | 1622 | 93 | 12 | 13 | ||
B3 | S_11_ Inclusion | Bagging-CART | 93.2% | 52.0% | 10.9% | 99.3% | 18.1% | 77.2% | 1609 | 106 | 13 | 12 | ||
B4 | S_11_ Inclusion | Bagging-C5.0 | 93.6% | 48.0% | 10.8% | 99.2% | 17.6% | 81.5% | 1616 | 99 | 12 | 13 | ||
B5 | S_11_ Inclusion | Bagging-RF | 93.9% | 44.0% | 10.6% | 99.1% | 17.1% | 81.9% | 1622 | 93 | 11 | 14 | ||
B6 | S_11_ Inclusion | Bagging-NB | 91.8% | 52.0% | 9.1% | 99.2% | 15.5% | 81.1% | 1585 | 130 | 13 | 12 |
No. | Dataset | Product Class | Data/Resampling Method Combination | Algorithm | ACR | Recall | PPV | NPV | F1 | AUC | TN | FP | TP | FN |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
C1 | Validation dataset | C | P_11_Inclusion | Bagging-CART | 90.1% | 39.0% | 16.9% | 97.4% | 23.6% | 66.1% | 3063 | 260 | 53 | 83 |
C2 | P_11_Inclusion | Ensemble learning | 94.4% | 19.9% | 24.5% | 96.7% | 22.0% | 67.2% | 3240 | 83 | 27 | 109 | ||
C3 | P_11_Inclusion | Bagging-Logistic | 92.6% | 23.5% | 17.5% | 96.8% | 20.1% | 58.4% | 3172 | 151 | 32 | 104 | ||
C4 | P_11_Inclusion | Bagging-NB | 83.1% | 36.0% | 9.0% | 97.0% | 14.4% | 58.6% | 2827 | 496 | 49 | 87 | ||
C5 | P_11_Inclusion | Bagging-C5.0 | 93.6% | 7.4% | 9.6% | 96.2% | 8.3% | 61.1% | 3229 | 94 | 10 | 126 | ||
C6 | P_11_Inclusion | Bagging-RF | 96.0% | 1.5% | 33.3% | 96.1% | 2.8% | 63.3% | 3319 | 4 | 2 | 134 |
Dataset | Product Class | Data/Resampling Method Combination | ACR | Recall | PPV | NPV | F1 | AUC | TN | FP | TP | FN |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Test dataset | A | P_11_Inclusion | 85.5% | 19.0% | 55.0% | 87.1% | 28.2% | 70.7% | 636 | 18 | 22 | 94 |
B | P_16_Inclusion | 95.3% | 28.6% | 13.0% | 98.7% | 17.9% | 78.0% | 1873 | 67 | 10 | 25 | |
C | P_11_Inclusion | 95.8% | 21.1% | 25.4% | 97.6% | 23.0% | 72.5% | 4813 | 94 | 32 | 120 |
Product Class | Overall Inspection | Prediction Model | ||||||
---|---|---|---|---|---|---|---|---|
No. of Batches | Inspection Rate | Hit Rate | Predicted Number of Batches | Recommended Number of Batches to be Inspected | Recommended Inspection Rate | No. of Model Hits | Model Hit Rate | |
A | 3643 | 18.64% | 15.76% | 770 | 40 | 5.19% | 22 | 55.00% |
B | 23,011 | 7.51% | 1.51% | 1975 | 77 | 3.90% | 10 | 12.99% |
C | 37,387 | 12.31% | 2.72% | 5059 | 126 | 2.49% | 32 | 25.40% |
Dataset | Product Class | Data/Resampling Method Combination | Algorithm | ACR | Recall | PPV | NPV | F1 | AUC | TN | FP | TP | FN |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Test dataset | A | P_11_Inclusion | Bagging-C5.0 | 84.2% | 23.3% | 45.0% | 87.5% | 30.7% | 66.1% | 621 | 33 | 27 | 89 |
Bagging-CART | 84.3% | 34.5% | 47.1% | 88.9% | 39.8% | 69.6% | 609 | 45 | 40 | 76 | |||
Bagging-Logistic | 82.3% | 8.6% | 25.0% | 85.5% | 12.8% | 58.2% | 624 | 30 | 10 | 106 | |||
Bagging-NB | 78.7% | 34.5% | 31.3% | 88.2% | 32.8% | 65.6% | 566 | 88 | 40 | 76 | |||
Bagging-RF | 85.2% | 17.2% | 52.6% | 86.9% | 26.0% | 69.8% | 636 | 18 | 20 | 96 | |||
Ensemble learning | 85.5% | 19.0% | 55.0% | 87.1% | 28.2% | 70.7% | 636 | 18 | 22 | 94 |
Dataset | Product Class | Data/Resampling Method Combination | Algorithm | ACR | Recall | PPV | NPV | F1 | AUC | TN | FP | TP | FN |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Test dataset | B | S_11_Inclusion | Bagging-C5.0 | 92.4% | 54.3% | 12.4% | 99.1% | 20.2% | 72.8% | 1806 | 134 | 19 | 16 |
Bagging-CART | 92.9% | 57.1% | 13.7% | 99.2% | 22.1% | 73.3% | 1814 | 126 | 20 | 15 | |||
Bagging-Logistic | 92.9% | 40.0% | 10.5% | 98.9% | 16.7% | 58.9% | 1821 | 119 | 14 | 21 | |||
Bagging-NB | 90.9% | 37.1% | 7.6% | 98.8% | 12.6% | 66.5% | 1782 | 158 | 13 | 22 | |||
Bagging-RF | 91.8% | 31.4% | 7.4% | 98.7% | 12.0% | 78.6% | 1803 | 137 | 11 | 24 | |||
Ensemble learning | 93.1% | 40.0% | 10.8% | 98.9% | 17.0% | 78.4% | 1824 | 116 | 14 | 21 |
Dataset | Product Class | Data/Resampling Method Combination | Algorithm | ACR | Recall | PPV | NPV | F1 | AUC | TN | FP | TP | FN |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Test dataset | C | P_11_Inclusion | Bagging-C5.0 | 93.4% | 8.6% | 6.2% | 97.1% | 7.2% | 64.9% | 4710 | 197 | 13 | 139 |
Bagging-CART | 93.1% | 46.1% | 20.7% | 98.3% | 28.6% | 72.7% | 4639 | 268 | 70 | 82 | |||
Bagging-Logistic | 92.0% | 26.3% | 12.1% | 97.6% | 16.6% | 57.1% | 4616 | 291 | 40 | 112 | |||
Bagging-NB | 87.6% | 35.5% | 9.3% | 97.8% | 14.7% | 66.6% | 4379 | 528 | 54 | 98 | |||
Bagging-RF | 96.7% | 5.9% | 29.0% | 97.2% | 9.8% | 75.3% | 4885 | 22 | 9 | 143 | |||
Ensemble learning | 95.8% | 21.1% | 25.4% | 97.6% | 23.0% | 72.5% | 4813 | 94 | 32 | 120 |
Product Class | Year (Comparable Period) | No. of Batches Declared | No. of Batches Inspected | Inspection Rate (%) | No. of Non-Conforming Batches | Non-Conformity Hit Rate (%) |
A | 2020 | 2463 | 361 | 14.66 | 54 | 14.96 |
2019 | 2547 | 412 | 16.18 | 53 | 12.86 | |
B | 2020 | 14,152 | 1438 | 10.16 | 48 | 3.34 |
2019 | 13,859 | 1035 | 7.47 | 18 | 1.74 | |
C | 2020 | 21,314 | 1424 | 6.68 | 64 | 4.48 |
2019 | 27,591 | 3209 | 11.63 | 78 | 2.43 |
Product Class | Inspection Rate | Non-Conformity Hit Rate | ||||
---|---|---|---|---|---|---|
2019 | 2020 | #p | 2020 | 2019 | #p | |
A | 16.18% (412/2547) | 14.66% (361/2463) | 0.1474 | 12.86% (53/412) | 14.96% (54/361) | 0.4612 |
B | 7.47% (1035/13,859) | 10.16% (1438/14,152) | <0.001 *** | 1.74% (18/1035) | 3.34% (48/1438) | 0.021* |
C | 11.63% (3209/27,591) | 6.68% (1424/21,314) | <0.001 *** | 2.43% (78/3209) | 4.48% (64/1424) | <0.001*** |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Wu, L.-Y.; Weng, S.-S. Ensemble Learning Models for Food Safety Risk Prediction. Sustainability 2021, 13, 12291. https://doi.org/10.3390/su132112291
Wu L-Y, Weng S-S. Ensemble Learning Models for Food Safety Risk Prediction. Sustainability. 2021; 13(21):12291. https://doi.org/10.3390/su132112291
Chicago/Turabian StyleWu, Li-Ya, and Sung-Shun Weng. 2021. "Ensemble Learning Models for Food Safety Risk Prediction" Sustainability 13, no. 21: 12291. https://doi.org/10.3390/su132112291
APA StyleWu, L.-Y., & Weng, S.-S. (2021). Ensemble Learning Models for Food Safety Risk Prediction. Sustainability, 13(21), 12291. https://doi.org/10.3390/su132112291