## 4 Results and Discussion
### Preprocessing Evaluation  
As a significant number of regression methods were developed for L&NL-PAC (16 regression methods in total), testing all the combinations of preprocessing alternatives and regression methods would be a time-consuming task. Therefore, an alternative strategy was devised to select a suitable preprocessing technique, in which representative regression methods from each class were considered and their prediction performance was assessed under different preprocessing techniques. The preprocessing technique that more often led to better and more stable predictions (i.e., lower prediction errors) was selected as the most effective.  
The prediction performances of the selected regression methods (RR and LASSO in the penalized regression class, PCR and PLS from the latent variable class; RF and BoRT from the tree-based ensembles, and kernel PCR and kernel PLS from the kernel-based methods), regarding the three enological parameters (sugar content, pH, and anthocyanin concentration), are presented in Figure 4. The prediction errors, given by the RMSE, indicate which combination of regression methods and preprocessing techniques had the better performance.  
Figure 4: Tukey boxplot showing the RMSE values of the external validation sets obtained by each preprocessing technique over the selected regression methods: (**a**) results for sugar contents, (**b**) results for pH, and (**c**) results for anthocyanin concentration. The bottom and top of the box represent the first and third quartiles (25 th and 75 th percentiles), and the internal horizontal lines represent the median (50 th percentile). The whiskers represent the maximum and minimum data within the 1.5 interquartile range (IQR) and the circles represent outliers outside 3 IQR.  
One can notice from Figure 4 that the SG second derivative was the worst preprocessing technique for this dataset as it often led to very high prediction errors. This was more clearly observed for the penalized regression methods. Excluding the second derivative, the alternative preprocessing techniques showed fewer differences and there was typically a significant overlap between different preprocessing methods for the same regression method. This suggests that the effect of the different preprocessing technique is not the most critical step and the SNV, MSC, or SG first derivative are expected to perform similarly; summary statistics (mean and standard deviation) for the distribution of the RMSE obtained for each preprocessing technique are presented in Table A1 (Appendix A). Moreover, Figure 4 displays a few outliers corresponding to instances where some combinations of models and preprocessing methods showed an abnormally high/low performance. This was expected as some peculiar training and test data splits can occur, leading to an abnormal model performance that is not representative. By observing the [PERSON]'s boxplot, the distribution of the RMSE can be better assessed in terms of percentiles, and the few outliers can be ignored.  
Concerning the literature mentioned in the introductory section (Table 1), the authors of [9] employed SNV, MSC, SG, and the second derivative to predict the anthocyanin concentration, denoting a better performance with SG and SNV techniques, and without differences between them. However, there are some works where preprocessing does not lead to an improvement in the results [8; 11]. In addition, the authors of [10] compared MSC with SNV preprocessing, concluding that the performance is case dependent. In this work, we selected the SG first derivative preprocessing as a suitable approach, as it often came up with smaller median prediction errors (this was observed for RR, PCR, PLS, kernel PCR, and kernel PLS) and presented an error variability that was similar to the other alternatives. Thus, the SG first derivative was used in the remainder of this paper to preprocess the spectra before the development of the regression models.