## 3 Results
### PLS-DA Analysis of NIR Spectra Collected on the Shell  
As mentioned, NIR spectra were collected on the whole nuts (i.e., on the shellnut); the average spectra for samples belonging to Class Sorrento (red line) and Class Non-Sorrento (blue line) are reported in Figure 1. From the plot is clear that the two spectra are very similar. Different pretreatments were tested on the data. The average classification error in cross-validation (reported in Table 2) was used to select the optimal preprocessing. The model providing the lowest classification error was the one built on data preprocessed by 1 st derivative. The application of this model to the test set led to 92.9% sensitivity and 96.9% specificity for Class Sorrento; naturally, due to the symmetry of the classification results for a two class-problem, these values are reversed in the case of Class Non-Sorrento, for which sensitivity was 93.6% and specificity 92.9%. Altogether, two Sorrento and one Non-Sorrento test objects were misclassified. A graphical representation of this outcome is also reported in Figure 2, where the predicted **y** is displayed as a function of the sample index. In the figure, training objects are represented by empty symbols, while the test ones are displayed as filled items. The black dashed line in the plot is the threshold: samples falling above it are assigned by the model to Class Sorrento, whereas those below the line are predicted as belonging to Class Non-Sorrento. From the representation, it is easy to spot the three misclassified test samples: one object belonging to Class Non Sorrento (Blue square) and two samples app \begin{table}
\begin{tabular}{c c c} \hline \hline
**Pre-Treatment** & **LVs** & **Average Classification Error (\%CV)** \\ \hline Mean Centering (MC) & 9 & 2.8 \\
1 st derivative (+ MC) & 11 & 1.6 \\
2 nd derivative (+ MC) & 9 & 2.9 \\ SNV (+ MC) & 12 & 3.4 \\ SNV+ 1 st derivative (+ MC) & 11 & 2.8 \\ SNV+ 2 nd derivative (+ MC) & 9 & 2.9 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Partial Least Squares-Discriminant Analysis (PLS-DA) modeling of the spectra collected on the nutshell–results of cross-validation (LVs: Latent variables). Figure 1: Average raw spectra collected on Sorrento (blue line) and Non-Sorrento (red line) walnuts (nutshell). Eventually, in order to understand which spectral variables contribute the most to the discrimination between the two categories, Variable Importance in Projection (VIP) [55] analysis was performed. Applying this approach, it is possible to obtain a VIP index for each predictor (i.e., spectral variable), reflecting its contribution to the discriminant model. Customarily, a variable presenting a VIP index higher than 1 is counted as relevant. Handling spectral data, the outcomes of VIP analysis can be straightforwardly inspected through a graphical representation such as the one reported in Figure 3.  
In the plot, variables presenting a VIP index higher than 1 are highlighted in red, over the mean spectrum of the samples. From the figure, it can be noticed that the area between 4000 and 4200 cm\({}^{-1}\) is selected. These variables interest the combination bands of C-H bonds and are probably due to the presence of fatty acids in walnuts. The spectral features constituting the peak at 5199 cm\({}^{-1}\) (approximately from 4840 cm\({}^{-1}\) to 5363 cm\({}^{-1}\)) also present VIP index \(>1\). These variables are linked to the CC and CH combination modes of unsaturated fatty acids [54]. A VIP index higher than 1 are is  
Figure 3: Variable Importance in Projection (VIP) Analysis. Mean spectrum (black line). Variables presenting a VIP index \(>1\) are highlighted in red. Figure 2: PLS-DA analysis: Predicted Y vs. sample index. Legend: Class Sorrento: Red diamonds; Class Non-Sorrento: Blue squares. The black dashed line represents the classification threshold between the two classes (Sorrento for y \(>\) threshold; Non-Sorrento for y \(<\) threshold). Empty and filled symbols represent training and test samples, respectively.