Introduction

Food packaging materials1, storage containers2, and processing facilities3 are in direct contact with food/water and can influence the safety level. As of now, more than 6500 chemicals are employed in the production of food contact materials (FCMs)4. The food packaging aims to increase the shelf-life of food by its protection against external contaminations5. In addition, the packaging materials can potentially impact the filling process as well as the transportation process of food. Zhang et al. have worked on automating a gas distribution system for the atmosphere packaging of fresh food6. To do so, this study combined the modified atmosphere preservation technology, fuzzy-based controller, and network communication technology.

The packaging material is a key factor that influences the chemical migration into the food7. This migration is required to be carefully monitored to evaluate the risks associated with chemicals in contact with foods. Polymeric materials, including low-density polyethylene (LDPE), polyethylene terephthalate (PET), high-density polyethylene (HDPE), polypropylene, polystyrene, and bioplastics8 are often used in food packaging9.

The chemical migration from FCMs into food is governed mainly by diffusion and is influenced by various factors, including temperature, time, and the compositions of both the food and FCM10,11. Chemical migration from packaging materials into foods under refrigeration conditions is both slower and smaller than that occurs at higher temperatures12. The packaging’s surface area to volume ratio is another factor that influences the amount of migrated chemicals. Food packages with a higher surface area to volume ratio experience more chemical migration into the food13, a situation that is especially relevant for foods intended for children (e.g. small size packages)14. Zhang et al. proposed an innovative methodology for the oyster packaging process15. The authors combined deep learning, machine vision, and mechanical arm control to automate the oyster packaging process.

The food contact chemical (FCC) migration is often evaluated by using the partition coefficient (Kpf), i.e., a key parameter for estimating chemical transfer from packaging materials into food10,11. This factor is calculated by dividing the chemical concentration in the food contact material by that in the food structure11. The impact of influential variables on Kpf (e.g. temperature, material type, and food characteristics) is often investigated by experimental methods. The limited migration information for major FCCs is likely related to the cost and time-intensive nature of doing such an experiment16. These complexities of the experimental analysis of chemical migration into foods have resulted in the utilization of the intelligent10,11 or mathematical17 models for the Kpf estimation. These models can be applied to anticipate the chemical migration from packaging materials into foods from several explanatory variables.

Limited correlation methods exist for determining Kpf, based on a chemical’s octanol-water partition coefficient (Kow) and the ethanol equivalency (EtOH-eq) for food’s polarity10,11,18. The solid material-water partition coefficient (Kmw) is also considered as an input variable once water is the food substance11.

Understanding FCC migration requires comprehensive model predictions, considering a wide range of scenarios. Some computational studies have developed regression models to evaluate chemical migration using the Food and Drug Administration (FDA) migration database19. With this database no longer accessible through personal means, advancing migration models requires new data acquisition.

Artificial intelligence (AI) methods can be effectively applied to simulate many phenomena in diverse contexts. Consequently, simulating the partition coefficient using machine learning (ML) techniques has gained significant attention. A novel ML-based weight-of-evidence (WoE) model focusing on assessing the carcinogenicity of FCCs, merged different computational approaches, improving the accuracy of identifying potentially carcinogenic chemicals20. This WoE model demonstrated an 8% improvement in under the receiver operating characteristic curve and a 19.7% increase in chemical coverage compared to the best singular method, identifying 44 high-risk carcinogenic chemicals. This efficient and thorough method aids in prioritizing chemicals for further analysis. Another study introduced a genetic algorithm-based WoE model21, combining techniques like structural alerts, quantitative structure-activity relationships, and in silico toxicogenomic models. It effectively prioritized 623 food packaging chemicals, identifying 26 as highly toxic, with 13 linked to developmental or reproductive issues. Further investigation is required for the remaining 13 chemicals. Recently, Huang and Jolliet compiled an extensive dataset with over 1800 data points, developing a regression model to predict food contact chemicals migration11.

Our main objective is to develop a reliable correlation based on ML methods to estimate logKpf for various food-packaging combinations. The relevancy analysis is employed for monitoring the impact of packaging materials, food characteristics, and temperature on the partition coefficient. Then, five different ML classes were designed to estimate the considered target variable, and their performances were compared to determine the highest accurate approach.

Problem description

Tables 1, 2 report a dataset comprising 1847 experimental logKpf values for different migration scenarios obtained from a prior study11. The data set includes the type of packaging material, temperature, logKow at 298 K, and EtOH-eq. The dataset comprises 232 distinct compounds and encompasses 19 various kinds of packaging materials. The ethanol equivalency values and the range of temperatures vary from 0 to 100%, and 275–313 K, respectively. The logKpf data vary from − 3.509 to 7.724. Amongst the nineteen types of packaging materials, LDPE, HDPE, and silicone rubber have the largest amount of experimental data, i.e., 804, 307, and 285, respectively.

Each type of food was given a specific ethanol equivalency value, which indicates its polarity22. The ethanol equivalency represents the proportion of ethanol in water, measured in volume/volume ratios and expressed as a percentage. Therefore, the ethanol equivalency ranges from 0 to 100, representing water at 0 and pure ethanol at 100. The maximum, average, minimum, and standard deviation (SD) values of the numerical features have also been reported. The SD value of each variable (V) can be calculated using Eq. (1)23.

$$SD=\,\sqrt {\sum\nolimits_{{p=1}}^{{NDP}} {{{\left( {{V_p}\, - \,{V^{ave}}} \right)}^2}} /(NDP - 1)}$$
(1)

Here, NDP is the number of data points. The Vave indicates the average value of a variable.

Table 1 Distribution of the utilized packaging materials in the literature11.
Table 2 Key statistical features of the quantitative variables11.

Results and discussion

Feature importance analysis, hyperparameter tuning of the AI-based paradigms, model selection by statistical inspection, outlier identification by leverage method, and trend monitoring are investigated in this section.

Feature importance analysis

Pearson’s correlation coefficient is a well-established statistically-based methodology to anticipate the direction as well as the relative importance of a relationship between two variables24. The numerical value of this coefficient is always between − 1 and + 1. The negative range for Pearson’s correlation is associated with the inverse relationship, while the positive range indicates a direct relationship. Also, a more important relationship is identified by a high absolute value of Pearson’s correlation. Figure 1 presents Pearson’s correlation coefficients between all input/output variables available in the current study. Both the last column and last row of this figure illustrate the direction and relative importance of the relationship of logKpf with the involved explanatory features (i.e., EtOH-eq, material type, logKow, and temperature). In summary, logKpf has the most important direct and inverse dependency on the logKow and EtOH-Eq, respectively.

Fig. 1
Fig. 1
Full size image

The heatmap of the Pearson’s correlation coefficients between all variables in the present study.

Model design

Each AI-based method has some structural features known as hyperparameters that must be appropriately determined. The first and second columns of Table 3 summarize the hyperparameter names of the MLP, CNN, LSTM, RF, and GBR models and their investigated ranges. The grid search algorithm is utilized to find the best hyperparameters of each AI-based tool. This search algorithm creates a parameters grid based on the specified ranges/values for the hyperparameters. Then, all combinations of the hyperparameters are used to build a model, which is trained and validated using the cross-validation subset. The last column of the following table reports the optimum value of the hyperparameters.

Table 3 The investigated range of hyperparameters of the AI models and their identified optimum values by the grid search algorithm.

Model selection

All the studies that applied machine learning methodologies for handling a classification25 or regression10 task evaluate model accuracy using different statistical indexes. This study also measures the deviation between actual (act) and predicted (pred) values of migrated chemicals from packaging materials to the food/water body using the mean absolute error (MAE), relative absolute error percent (RAE%), mean squared error (MSE), correlation coefficient (R), and root MSE (RMSE). The MAE, RAE%, MSE, RMSE, and R can be computed from Eq. (2) to (6), respectively26.

$$MAE=\,{\sum\nolimits_{{p=1}}^{{NDP}} {\left| {act - pred} \right|} _p}/NDP$$
(2)
$$RAE\% =100\, \times \,\,\left( {\sum\nolimits_{{p=1}}^{{NDP}} {{{\left| {act - pred} \right|}_p}/\sum\nolimits_{{p=1}}^{{NDP}} {{{\left| {act - ac{t^{ave}}} \right|}_p}} } } \right)$$
(3)
$$MSE=\,\sum\nolimits_{{p=1}}^{{NDP}} {\left( {act - pred} \right)} _{p}^{2}/NDP$$
(4)
$$RMSE=\,\sqrt {MSE}$$
(5)
$$R=\sqrt {1 - \,\left[ {\sum\nolimits_{{p=1}}^{{NDP}} {\left( {act - pred} \right)} _{p}^{2}/\sum\nolimits_{{p=1}}^{{NDP}} {\left( {act - ac{t^{ave}}} \right)_{p}^{2}} } \right]}$$
(6)

The average value of the experimental data can be obtained from Eq. (7).

$$ac{t^{ave}}\,=\,\left( {1/NDP} \right)\, \times \,{\sum\nolimits_{{p=1}}^{{NDP}} {\left( {act} \right)} _p}$$
(7)

All these performance metrics aim to measure the compatibility between actual and predicted values of the target variable. A model that presents smaller MAE, RAE, MSE, and RMSE values than the other is preferred from the modeling perspective. It must also be noted that this model must also possess a higher R value. Table 4 presents the performance of the designed AI-based methods in the cross-validation (CV) and testing stages in terms of MAE, RAE%, MSE, RMSE, and R indices. This table also introduces the overall performance of the checked AI-based methods.

Table 4 Performance analysis of AI-based methods by the statistical indices.

Since there are the numerical values of five statistical indices for the CV and testing stages, it is not easy to identify the best method by visual inspection. Figure 2 separately illustrates the ranking places of the developed AI-based methods for the CV and testing stages. It can be seen that the GBR, which has the first rank in both the CV and testing stages, is the most accurate model for computing the amount of migrated chemicals from packaging materials to the food/water body.

The GBR method predicts 1478 experimental samples of the CV stage with the MAE = 0.13, RAE = 5.58%, MSE = 0.04, RMSE = 0.19, and R = 0.9977. It also provides MAE = 0.24, RAE = 10.13%, MSE = 0.16, RMSE = 0.39, and R = 0.9895 for predicting 369 unseen testing samples.

On the other hand, the RF model, with the fifth and fourth rankings in the CV and testing stages, is the worst model for predicting the target variable. It must be highlighted that the prediction performance of the RF model is also acceptable from the modeling point of view, but amongst the five designed methods, it provided the most unreliable predictions.

Fig. 2
Fig. 2
Full size image

Comparing the performance ranking order of the utilized AI-based models.

The relative error (RE) between actual and predicted values of a target variable can be computed using Eq. (8).

$$RE = \,\left( {act - pred} \right)_{p} /\left( {act} \right)_{p} \,\,\,\,\,\,\,\,p = 1,\,2,\,...,\,NDP$$
(8)

Figure 3 presents the observed RE values between the experimental data and those predicted by the GBR, CNN, LSTM, RF, and MLP models. This figure approves that the GBR model has predicted the actual data with the smallest relative error ranging from − 27 to 11. It can also be concluded that the RF model has estimated the actual data with the highest RE values ranging from − 84 to 152.

Fig. 3
Fig. 3
Full size image

Comparing the models’ prediction accuracy by the relative error.

Assessment of the GBR performance

The scatter graph between GBR predictions and experimental measurements of the chemical migration from packaging materials to food/water is shown in Fig. 4a. The accumulation of both CV and testing samples around the diagonal line indicates the outstanding ability of the constructed GBR method in precisely simulating the chemical migration from packaging materials to the food body. The observed regression coefficients of 0.9977 (CV stage) and 0.9895 (testing step) also approve the excellent performance of the proposed GBR method.

The histogram of the observed residual error (actual – prediction) in the CV and testing periods has been exhibited in Fig. 4b. This analysis approves that ~ 800 CV and ~ 100 testing records have been estimated with an error almost equal to zero. It can also be viewed that the residual error in the CV and testing steps ranges from − 1 to + 1. It is worth noting that the mean and standard deviation of the overall error are − 0.0050569 and 0.24314, respectively.

The KDE (kernel density estimation) versus magnitude profiles for the experimental chemical migration and GBR prediction have been depicted in Fig. 4c. This investigation justifies the excellent agreement between actual and simulated KDE-magnitude profiles.

Fig. 4
Fig. 4
Full size image

Checking the compatibility between actual and predicted values of the target variable by (a) cross-plot, (b) histogram of residual errors, and (c) KDE-magnitude profile.

Validity domain inspection

The leverage algorithm provides a practical ground to separate valid records from outliers and out-of-leverage samples27. The leverage method needs the numerical values of the standardized residual (StR), Hat index (HI), and critical HI (CHI) to separate the normal from the abnormal measurements. Equation (9) to (11) present the formula of these parameters.

$$St{R_p}\,=\,{\left( {act - pred} \right)_p}/\sqrt {\sum\nolimits_{{p=1}}^{{NDP}} {{{\left( {{{\left( {act - pred} \right)}_p}\, - \,{{\left( {act - pred} \right)}^{ave}}} \right)}^2}/NDP} } \,\,\,\,\,\,\,\,\,\,p=1,\,2,\,.,NDP$$
(9)
$$HI\,=\,M\,{\left( {{M^T}\,M} \right)^{ - 1}}\,{M^T}$$
(10)
$$CHI\,=\,3 \times \left( {N\,+1} \right)/NDP$$
(11)

N and M indicate the number of input variables (i.e., 4) and the matrix of their numerical values.

The confined region by the StR = ± 3 and HI < CHI includes valid samples. On the other hand, the StR-HI samples located in other areas of this plot are either outlier or out-of-leverage.

As Fig. 5 illustrates, it is easy to see that the leverage algorithm has detected 56 problematic samples (outlier + out-of-leverage) amongst 1847 experimentally-measured chemical migration from packaging materials to food and water. This small percentile (~ 3%) of the problematic data is not big enough to negatively affect the GBR performance. So, there is no need to remove this small number of abnormal data from the conducted analyses.

Fig. 5
Fig. 5
Full size image

Identifying outlier, valid, and out of leverage samples.

Parametric analysis

The influence of logKow on the logKpf at four polarity levels (EtOH = 40.6, 55.9, 79.2, and 100) from both experimental and simulation perspectives have been presented in Fig. 6. This figure confirms the excellent capability of the proposed GBR method in predicting the EtOH-eq and logKow impact on the logKpf in actual situations. The experimental and simulation findings justify that the logKpf increases by decreasing EtOH-eq or increasing the logKow.

Fig. 6
Fig. 6
Full size image

Effect of ethanol equivalency on chemical dissolution in food (HDPE, 298 K).

The experimental and simulated logKpf versus logKow profiles at three temperature levels (283, 296, and 313 K) have been plotted in Fig. 7. The acceptable agreement between actual and predicted chemical migration from the packaging materials to the food/water can be concluded by this analysis. It can also be seen that the logKpf has a complex dependency on the temperature. The temperature rise first decreases the chemical migration from the packaging materials to the food body, and then it increases the chemical dissolution in the food structure.

Fig. 7
Fig. 7
Full size image

Effect of temperature on chemical dissolution in foods (average HDPE/LDPE, EtOH-eq = 100).

Limitations of the current study

The proposed AI-based models in this study can only be applied to anticipate the amount of migrated chemicals from the involved packaging materials (see Table 1) into food/water in the investigated range of temperature and logKow (see Table 2).

Conclusions

The objective of this study is to simulate the chemical migration from packaging materials into foods and analyze how this process is influenced by temperature and the properties of foods and packaging materials. The multi-layer perceptron neural networks, convolutional neural networks, long short-term memory, Random Forest, and gradient boosting regressor (GBR) have been applied to unravel the potential relationship between chemical migration and its explanatory variables. Below are the key numerical and qualitative of our study:

  • logKow and ethanol equivalency (EtOH-Eq) are the most important features to simulate the considered problem.

  • The GBR showed superior predictive performance compared to the multi-layer perceptron neural networks, long short-term memory, and Random Forest, convolutional neural networks.

  • The GBR showed remarkable accuracy in estimating 1478 cross-validation samples, i.e., mean absolute error (MAE) of 0.13, relative absolute error (RAE) of 5.58%, mean squared error (MSE) of 0.04, root mean squared error (RMSE) of 0.19, and a correlation coefficient (R) of 0.9977.

  • The GBR performance also remains robust when it was checked by 369 unseen testing samples, i.e., MAE = 0.24, RAE = 10.13%, MSE = 0.16, RMSE = 0.39, and R = 0.9895.

  • Only 56 out of 1847 experimental measurements reported in the literature could potentially be either outliers or out of leverage.

  • The chemical migration experiences a notable decrease with increasing the food’s polarity, i.e., EtOH-Eq.

  • Chemical migration into food has a complex dependency on temperature, initially decreasing with increasing temperature, followed by an increasing response.

  • It was also observed that chemical migration continuously increases by increasing logKow.

Future works in this field may utilize complex modeling techniques and hybridized AI approaches to estimate chemical migration from emerging packaging materials, such as bioplastics or nanocomposites into foods, water, and even drugs.