# Olive Oils Classification via Laser-Induced Breakdown Spectroscopy
## 3 Results and Discussion
### Classification Results Using the PCA Pre-Processed LIBS Spectroscopic Data
For the training of the LDA algorithm 35 canonical variables were used. As it is shown from the scatter plots, the H-samples and all the C-samples are well distinguished from the rest of the samples, but an overlapping between the L- and R-samples is still noticeable. To provide more insight on the k-NN, SVC and LDA algorithms' behavior when combined with the preprocessing of the input data by PCA, the corresponding classification report was prepared and is presented as Table 2. The precision and recall values for k-NN, SVC and LDA algorithms on the preprocessed data with the PCA, are presented in the classification reports in Tables S2b, S3b and S4b, respectively, in the Supplementary Material section. As can been seen in Table 2, in the case of k-NN, 16 of the 36 olive oil samples present f1-scores lower than 0.5, indicating that the k-NN model is not a successful choice to provide a correct classification of the present samples based on the LIBS spectroscopic data input. The macro average was found to be 0.6 or 60%, which is very close to the accuracy of the algorithm which was (\(56.9\pm 2.5\))%. In contrast, all 36 samples in the case of the SVC algorithm (except one sample) and the LDA algorithm, have quite high f1-scores, a finding which is further confirmed by the averages, which attained values of 0.9 and 1.0 respectively. It should be mentioned that the values of the averages are very similar to the obtained algorithmic accuracies, which were (\(88.9\pm 1.2\))% and (\(94.0\pm 1.1\))% respectively. Therefore, it results, that in the case of the LIBS data preprocessed by PCA, both the SVC and especially the LDA predictive models were found to exhibit very high accuracies and great robustness. Figure 4: (**a**) Cumulative explained variance, loadings plots for (**b**) PC1, (**c**) PC2, and (**d**) PC3. It must be emphasized at this point, that during the hyperparameter tuning of the SVC algorithm, the optimum kernel that was chosen for training was a linear one. Considering that both, LDA and PCA, are linear transformation techniques (in contrast to the k-NN which is a non-linear model), it is obvious that the LIBS spectroscopic data that were used are most probably better characterized by linear correlations and for this reason linear models are found to be more effective for their treatment and discrimination purposes. Summarizing the accuracies determined for the different predictive models employed were determined as follows: for the non-preprocessed LIBS data: k-NN: (\(57.2\pm 2.7\))%, SVC: (\(89.4\pm 0.9\))%, LDA: (\(71.5\pm 2.4\))% and for the PCA preprocessed LIBS data: k-NN: (\(56.9\pm 2.5\))%, SVC: (\(88.9\pm 1.2\))%, LDA: (\(94.0\pm 1.1\))%. To further validate the accuracy of the obtained results, an external validation procedure was also performed, by utilizing the most successful model created in this work, i.e., LDA with PCA pre-processing. In that way the predictive abilities of our models can be further tested. In this case, the training set contained 25 LIBS spectra from each oil sample (i.e., samples C1-C9, H1-H12, L1-L7 and R1-R8), while the test set contained 5 unique LIBS spectra from each sample, as well. The training was performed with 5-fold cross-validation and attained a predictive accuracy of (\(94.1\pm 1.6\))%, by using 30 PCs as inputs. The prediction accuracy by using the created model to validate the test set reached 93.88% agreement with the training data. These results are summarized in Table 3.  
To the best of our knowledge, there are only two studies reported in the literature employing LIBS assisted by machine learning approaches, aiming to discriminate/classify olive oils in terms of their geographical origins. In the first of them, reference [13], neural networks have been used to provide a successful classification of the studied oils, attaining an accuracy of 95%. However, the samples employed were typical commercial edible oils (from the local market), containing different brands and grades (e.g., olive oil, sunflower and hazelnut and corn oils).