## 3 Results and Discussion
### Random Forest Models Based on Feature Extraction  
The various parameter settings for smoothing effectively reduced noise and provided enhanced spectral signals, thereby facilitating more accurate feature extraction and classification. Initially, the spectral dataset comprised 3164 features (variables) corresponding to the wavenumbers (cm\({}^{-1}\)) in the selected region of the FTIR spectrum. The RF model was applied for feature selection, with two different thresholds for feature importance set at 0.001 and 0.0001 to determine the most influential variables contributing to classification accuracy. The feature selection process was crucial in reducing the number of features, simplifying the model, and improving the overall computational efficiency while maintaining high classification accuracy. The number of selected features and the resulting classification accuracies varied significantly depending on the threshold for feature importance and the S-G smoothing parameters (Tables 3 and 4). The results obtained indicated that with a feature importance threshold of 0.001, the classification accuracy of the RF model during external validation varied between 0.83 and 0.91, depending on the specific S-G smoothing parameters. It was observed that applying S-G smoothing improved the accuracy compared to using raw spectral data without any smoothing (e.g., 0.87 without S-G versus 0.91 with two S-G configurations). It should be noted that the application of S-G smoothing with the second derivative (d = 2), second- and third-order polynomials (p = 2, p = 3), and window sizes (w) of 12 and 13 points achieved the highest accuracy (0.91) while selecting around 365-398 features. However,  
Figure 1: FTIR spectra in the region 4000–900 cm\({}^{-1}\) of extra virgin olive oil (EVOO class) versus a lampante olive oil (denoted as other class). \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**S-G Parameters** & **Original Features** & **Important Features** & **Accuracy (Testing)** &
\begin{tabular}{c} **Accuracy** \\ **(External Validation)** \\ \end{tabular} \\ \hline Without S-G * & 3164 & 352 & 0.88 & 0.87 \\ d = 2, p = 2, w = 11 & 3164 & 375 & **0.90** & 0.83 \\ d = 2, p = 3, w = 11 & 3164 & 930 & 0.84 & 0.83 \\ d = 2, p = 2, w = 12 & 3164 & 400 & **0.90** & 0.89 \\ d = 2, p = 3, w = 12 & 3164 & 398 & **0.90** & **0.91** \\
**d = 2, p = 2, w = 13** & 3164 & 365 & 0.86 & **0.91** \\ d = 2, p = 3, w = 13 & 3164 & 369 & **0.90** & 0.85 \\ \hline \hline \end{tabular}  
* Raw data; S-G: Savitzky–Golay; d: derivative order; p: polynomial order; w: window size.  
\end{table} 
Table 3: Results of the RF models developed on the FTIR spectral data based on different preprocessing techniques using 0.001 as the feature importance threshold, together with classification accuracies obtained in both testing and external validation. a slightly lower accuracy (0.89) was obtained when using a second-order polynomial (p = 2) and a window size (w) of 12 points, selecting 400 features. Without smoothing, the RF model retained 352 features and reached a testing accuracy of 0.87, highlighting the advantage of applying pre-processing to reduce spectral noise. In addition, the combination of different window sizes and polynomial orders for S-G smoothing influenced the number of features retained, demonstrating the importance of careful tuning of pre-processing steps to optimize classification performance. The results of the analysis revealed that with a lower feature importance threshold (0.0001), more features were selected across the spectrum, resulting in a higher number of important variables being retained. The classification accuracy with this threshold ranged from 0.74 to 0.91, with the highest accuracy being 0.91. Notably, without S-G smoothing, 963 features were retained, achieving an accuracy of 0.87, which is identical to the previous threshold result but with more retained features.