*3.3. Comparison and Analysis of Various Models*

The variable selection method was selected to filter the characteristic variables of the sensor data, and the PLS prediction model of the number of days of apple spoilage was established. The specific results of the apple spoilage time prediction model established by the variable selection method are shown in Table 2. The scatter plot of the apple spoilage time prediction model is shown in Figure 6, in which the Rc and Rp of ACO-PLS are 0.971 and 0.926, respectively, the Rc and Rp of SA-PLS are 0.942 and 0.936, respectively, and ACO-PLS has the highest Rc, but Rp is low. In order to ensure the prediction accuracy of

the apple spoilage model, the variables were numbered from 1 to 3000, and SA-PLS was used to establish an early warning model of apple spoilage. The characteristic variables were identified to be 1889, 1894, 1974, 2001, 2159, 2163, 2274, 2561, 2758 and 2965. A similar observation was made by Guo et al. [41], where they observed that the competitive adaptive reweighted sampling (CARS) algorithm combined with PLS effectively filtered irrelevant information and improved the accuracy of the model in predicting apple spoilage area from the electronic nose data. Table 3 showed the characteristic variables and original variable ranges screened by SA.

**Table 2.** Prediction model results of days before apple spoilage using C2H4, CO2, VOC and O2 sensor data.


**Table 3.** Characteristic variables and original variable ranges of each sensor in the apple spoilage early warning model.


According to the results of the SA-PLS spoilage early warning model, the dependent variables, independent variables, and coefficients of the model were derived. The model results are shown in Table 4. The apple spoilage early warning model is as follows: Y = 0.3264 X1 + 0.3708 X2 + 0.0248 X3 + 0.0363 X4 − 0.0008 X5 − 0.0005 X6 − 0.0014 X7 + 0.4734 X8 + 0.3338 X9 +0.0248 X10 − 0.0136 X11 − 0.0118 X12 − 0.0132 X13 + 0.3407 X14 − 1.9581 X15 + 0.3719 X16 + 0.5173 X17 − 1.9010 X18 + 0.0013 X19 − 0.0009 X20 + 38.9899. Among these values, X1–X20 are the dependent variables, that is, the value of the sensor corresponding to the screening feature variable. When the value of Y is in the range of 1–8, the Y value from 1–2 indicates the freshness of the product, whereas a value between 3 and 4 indicates spoilage. Similarly, a value of 5–6 indicates that the spoilage grade is medium spoilage, and a value of 7–8 indicates that the spoilage grade is severe spoilage.

**Table 4.** Independent variables, dependent variables and coefficients of apple spoilage early warning model.

