## 4 Results and Discussion
### Sugar Content Analysis  
The sugar content is one of the main quality characteristics to evaluate the maturity of grapes and was the first property considered for developing the regression models. The Savitzky-Golay first derivative was applied to the spectra as a preprocessing technique and the RMSEs obtained from the Monte Carlo double cross-validation are presented in Figure 5 for all the regression methods included in this study. This figure clearly demonstrates the need to test a wide range of regression methods from different classes, as the performance of certain methods can be significantly different, even within the same class of methods. Only by testing and comparing their performance can one choose the most suitable regression model for each case. In addition, in order to characterize the overall method's performance, Figure 6 summarizes the KPI (described in Section 3.3) obtained by each regression method. From the analysis of Figures 5 and 6, it is possible to identify that RR was the best regression method for predicting the sugar content, obtaining the lowest RMSE (Figure 5) and the best overall performance with the highest KPI (Figure 6). More precisely, the difference between RR and the other regression methods was statistically significant (two points were always attributed to RR method, see Section 3.3). One can also notice that the class of tree-based ensembles is not suitable for predicting the sugar content, which can probably be attributed to the regression tree's stepwise approximation. The underlying relationship between the spectral signals and contents often follows the Beer\(-\)Lambert law, which is a continuous function instead of a stepwise relationship. The class of latent variable methods contains the worst method, which is the combination of PCA and a linear kernel SVR. Nevertheless, the other methods in this class presented a good and consistent performance (Figure 5). The newly tested alternatives based on non-linear kernels had rather different performances, namely kernel PLS and PCR (both rbf), which achieved the lowest RMSE (Figure 5), reaching a good position (third and fourth, respectively), among the top performances (Figure 6). Despite this result, the performance of the class of kernel  
Figure 5: Tukey boxplot showing the sugar content results to the external validation sets obtained for the classes of regression methods included: (blue) variable selection, (red) penalized regression, (green) latent variables, (purple) tree-based ensemble, and (orange) Kernel methods. Figure 6: KPI obtained by each regression method when applied to predict the sugar content. methods suggests that the use of non-linear methods is not particularly advantageous for predicting the sugar content. Nevertheless, other types of non-linear approaches may be more effective, e.g., using neural networks, as in our previously published works [7; 13], which presented RMSE values between 0.95 and 0.96 \({}^{\circ}\)Brix for the same set of data. Moreover, in [7], a comparison between PLSR and NN was done, where the results showed a similar performance between the two methods. Comparing the results reported in [7; 13] to those obtained in this study (Figure 5), one can notice that the results here are more conservative because a double cross-validation procedure was employed in multiple runs, which allowed for a more comprehensive incorporation of all variation and uncertainty sources present in the raw data as well as during model development. Thus, there were testing scenarios where the RMSE was below 0.95 \({}^{\circ}\)Brix, but there were others where the observed performance was worse, depending on the particular random data split in training and validation sets. This demonstrates that the data split plays an important role when determining the methods' performance, and therefore the reported results should have an increased focus on assessing all sources of variability and uncertainty.