## 3 Results  
The pH and MC of the apples were measured to be 3.40 \(\pm\) 0.05 (mean \(\pm\) standard deviation) and 87.82 \(\pm\) 1.43% (w.b. ), respectively. Figure 1 shows the mean NIR spectra of apple samples at different maturity stages. It is apparent that the reflectance values are higher in the red region (630 nm) for the maturity stage 3. One can note a transition occurring at about 610 nm. Such observation is reasonable as the color of the apples turns redder as the samples mature. In the meantime, the applesfrom the maturity stage 1 (less matured samples) have a stronger peak around the green region (550 nm). The feature selection algorithms ranked features according to their contribution to the prediction of the target variables. Figure 2a shows the 11 best corresponding features for MC and pH. Among them, a total of 11 features (10 wavelengths + 1 maturity stage) were identified as optimum features for the simultaneous detection of MC and pH for all of our subsequent analyses. These features include 466.86, 468.89, 472.94, 666.43, 689.93, 692.07, 694.22, 696.36, 702.80, 1028.06 nm, and \"Maturity stages\". The 11 features identified were used as inputs in the ANN, with an input layer fed by 11 features, two hidden layers, and one output layer. The first and second hidden layers had 10 and 70 neurons, resulting in an overall ANN structure of 11-10-70-2 (Figure 2b). Table 1 shows the performance of the various predictive model for the testing set. The performance of the MC predictors was promising, with \(R\)-values in the range of 0.844-0.868, with the best performance achieved under ANN. However, the developed model proved to be unreliable in predicting the pH value, with \(R\)-values ranging from 0.190 to 0.383. Despite this, the ANN model still delivered the best performance. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Model** & **Outputs** & **R** & **RMSE** & **MAE** & **MAPE** \\ \hline \multirow{2}{*}{ANN *} & pH & 0.383 & 0.044 & 0.035 & 0.010 \\ \cline{2-6}  & MC & 0.868 & 0.756 & 0.578 & 0.007 \\ \hline \multirow{2}{*}{DT **} & pH & 0.307 & 0.046 & 0.036 & 0.011 \\ \cline{2-6}  & MC & 0.844 & 0.812 & 0.605 & 0.007 \\ \hline \multirow{2}{*}{KNN ***} & pH & 0.373 & 0.044 & 0.035 & 0.010 \\ \cline{2-6}  & MC & 0.847 & 0.801 & 0.627 & 0.007 \\ \hline \multirow{2}{*}{MLR} & pH & 0.190 & 0.049 & 0.038 & 0.011 \\ \cline{2-6}  & MC & 0.857 & 0.777 & 0.580 & 0.007 \\ \hline \multirow{2}{*}{PLSR} & pH & 0.231 & 0.047 & 0.038 & 0.011 \\ \cline{2-6}  & MC & 0.864 & 0.759 & 0.574 & 0.007 \\ \hline \hline \end{tabular}  
* The layers and number of neurons for the ANN model are 11-10-70-2, the Epoch value is 500, and the activation function is _tanh-tanh_ for each output parameter. ** Numbers of pH and moisture content splits are 2 and 5, respectively. *** The k value is 10 for both pH and moisture content.  
\end{table} 
Table 1: Performance results of the machine learning algorithms. Figure 1: Mean spectra of different maturity stages. The scatter plots representing the relationship between the actual and predicted values of each output parameter under various models are presented in Figures 3 and 4. In these scatter plots, the dark blue regions represent the 95% confidence intervals, estimating the range within which the mean difference between predicted and actual values is likely to fall. The light blue regions, on the other hand, represent the 95% prediction intervals. These intervals estimate the likely range of individual observations for specific predicted values, considering both the average difference and the natural variability of the observations. These confidence and prediction intervals help assess the reliability of the developed model's predictions and the degree of variability one might expect [46]. Figure 2: Selected features (**a**) 15 best features for predicting MC and pH and (**b**) ANN structure for simultaneous detection of MC and pH using 11 optimum features.