Next Article in Journal
A Bidirectional Bridge for Cross-Chain Revocation of Verifiable Credentials in Segregated Blockchains
Previous Article in Journal
Metaheuristic Hyperparameter Optimization Using Optimal Latin Hypercube Sampling and Response Surface Methodology
Previous Article in Special Issue
Bottlenose Dolphins’ Clicks Comply with Three Laws of Efficient Communication
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Evaluating LDA and PLS-DA Algorithms for Food Authentication: A Chemometric Perspective

Research and Breeding Institute of Pomology Holovousy Ltd., Holovousy 129, 508 01 Hořice, Czech Republic
*
Author to whom correspondence should be addressed.
Algorithms 2025, 18(12), 733; https://doi.org/10.3390/a18120733
Submission received: 13 October 2025 / Revised: 12 November 2025 / Accepted: 15 November 2025 / Published: 21 November 2025
(This article belongs to the Collection Feature Papers in Algorithms)

Abstract

High-dimensional analytical datasets, such as those generated by inductively coupled plasma–mass spectrometry (ICP-MS), require robust computational frameworks for dimensionality reduction, classification, and model validation. This study presents a comparative evaluation of Linear Discriminant Analysis (LDA) and Partial Least Squares Discriminant Analysis (PLS-DA) algorithms applied to multivariate chemometric data for food origin authentication. The research employs a workflow that integrates Principal Component Analysis (PCA) for feature extraction, followed by supervised classification using LDA and PLS-DA. Model performance and stability were systematically assessed. The dataset comprised 28 apple samples from four geographical regions and was processed with normalization, scaling, and transformation prior to modeling. Each model was validated via leave-one-out cross-validation and evaluated using accuracy, sensitivity, specificity, balanced accuracy, detection prevalence, p-value, and Cohen’s Kappa. The results demonstrate that, as a linear projection-based classifier, LDA provides higher robustness and interpretability in small and unbalanced datasets. In contrast, PLS-DA, which is optimized for covariance maximization, exhibits higher apparent sensitivity but lower reproducibility under similar conditions. The study also emphasizes the importance of dimensionality reduction strategies, such as PCA-based variable selection versus latent space extraction in PLS-DA, in controlling overfitting and improving model generalizability. The proposed algorithmic workflow provides a reproducible and statistically sound approach for evaluating discriminant methods in chemometric classification.

1. Introduction

Determining the origins of plant-based foods has become more important in response to concerns about food fraud, traceability, and consumer protection [1,2,3]. Spectrometric methods, particularly inductively coupled plasma mass spectrometry (ICP-MS), generate detailed mineral, and isotopic profiles that can classify samples by origin [1,4,5,6,7,8,9]. Although analytically powerful, ICP-MS datasets are usually characterized by specific mathematical properties: they produce high-dimensional feature spaces (typically 15–40 elemental variables) with strong multicollinearity due to geochemical co-occurrence patterns and environmental, agronomic, and genetic factors combined with relatively small sample sizes dictated by analytical costs and sample availability [10,11,12]. From a computational perspective, such datasets present fundamental algorithmic challenges: the ratio of observations to feature approaches or falls below unity, the predictor matrix X exhibits rank deficiency or near-singularity, and correlations among predictors violate independence assumptions of classical discriminant methods. These conditions necessitate dimensionality reduction strategies and careful algorithm selection to prevent overfitting while maintaining discriminatory power.
Chemometrics integrates chemical measurements with algorithmic analysis to provide this framework. It extracts latent structures, assesses variable importance, and validates the predictive performance of computational methods. Apples (Malus domestica Borkh.) are a relevant case study due to their global importance and cultivar-specific variability in mineral uptake, which is influenced by soil geochemistry [13]. Recent studies have validated the effectiveness of ICP-MS for apples and related products [12,14]. This method can be complemented by metabolomics approaches [15]. However, fine-scale origin discrimination remains challenging in areas with similar geomorphological and pedological histories, such as Central Europe [10,16]. Current research focuses on algorithm optimization and improved workflows to increase throughput and reproducibility [12,17,18].
To address the complexity of high-dimensional elemental datasets, a common strategy is to apply Principal Component Analysis (PCA) as an initial exploratory step to reduce dimensionality and reveal latent variance structure. PCA projects correlated variables onto orthogonal components that capture maximum variance. Mathematically, a PCA performs an eigendecomposition of the covariance matrix Σ = X^T X, extracting principal components as linear combinations of original variables that maximize explained variance under orthogonality constraints. This process facilitates the identification of clustering, separation, and potential outliers while suppressing noise and redundancy [19]. In food authentication, PCA is an effective preprocessing tool before supervised modeling [20,21]. PCA often forms the basis for subsequent discriminant analysis in spectroscopy-based studies [22,23].
Following this unsupervised reduction, supervised classification methods can evaluate the discriminatory power of chemical profiles with respect to different classifiers, such as the geographical origin. Linear Discriminant Analysis (LDA), one of the most well-established techniques, seeks linear combinations of predictors that maximize between-group separation while minimizing within-group variance [24]. Specifically, LDA solves the generalized eigenvalue problem (S_B)w = λ(S_W)w, where S_B and S_W represent between-class and within-class scatter matrices, respectively. This formulation requires S_W to be invertible, which fails when the number of features, p, approaches or exceeds the number of observations, n, or when features are highly correlated—conditions frequently encountered in ICP-MS datasets. LDA has repeatedly demonstrated strong performance in food authentication studies [25,26]. In contrast, Partial Least Squares Discriminant Analysis (PLS-DA) is designed for scenarios involving multicollinearity or when the number of predictors exceeds the number of observations. PLS-DA circumvents the singularity problem by projecting X and the categorical response Y onto a shared latent space, extracting components t_h that maximize the covariance cov(Xw_h, Yc_h) rather than variance alone. This bilinear decomposition inherently performs a dimensionality reduction while optimizing for class discrimination, making it theoretically suitable for high-dimensional, small-sample scenarios [27,28].
Recent applications demonstrate that combining PCA for feature reduction with LDA or PLS-DA for classification enables robust discrimination even when regional similarities complicate origin assignment [20,21,25,29]. In apple studies, supervised models have achieved high accuracy. However, their relative performance varies depending on the scale at which distinctions are made (e.g., regional versus local) and the variability arising from interactions between soil characteristics and apple cultivars [13,16]. For example, a study by Zhang et al. [30] compared stepwise LDA with PLS-DA in flash-GC volatile analysis, demonstrating subtle yet reliable discrimination of regional origins. Similar strategies in honey, tea, and vinegar likewise highlight the general usefulness of PCA–LDA/PLS workflows [20,21,25]. Nevertheless, a comprehensive evaluation of the model quality and stability—particularly regarding the trade-offs between apparent accuracy, cross-validated performance, and the detection prevalence in unbalanced, small datasets—remains insufficiently characterized in the literature.
Cross-validation is an integrated statistical approach used to evaluate the performance and generalization ability of mathematical models. Its implementation is based on dividing the dataset to the training set, allowing us to build up the model and validation set to test the model performance. On the other hand, classification models can also be specified for appropriate set of variables. For this purpose, several different approaches are on hand, like [31,32,33]. Cross-validation is crucial to prevent overfitting, support parameter optimization, and provide unbiased estimates of predictive power [34,35].
In accordance with the best computational practices in chemometrics, this study presents a rigorous algorithmic framework for comparing the LDA and PLS-DA under constrained data conditions typical of analytical chemistry applications. The dataset used in our study exhibits critical dimensionality properties: 28 observations × 19 features (18 minerals plus 10B/11B isotope ratio), yielding an observation-to-feature ratio of 1.47, well below the threshold for conventional LDA estimations. The dataset exhibits multicollinearity and class imbalance (4–13 samples per geographic origin), creating an ideal testbed for evaluating the discriminant algorithm robustness.
The properties of our model dataset define a near-singular regime where the condition of the stable discriminant analysis is compromised, necessitating explicit dimensionality reduction or intrinsic latent variable extraction methods.
Our methodological contribution lies in the systematic comparison of two dimensionality reduction philosophies: (1) explicit feature selection via PCA followed by LDA projection versus (2) implicit dimension reduction through PLS-DA’s latent variable extraction. We evaluate these approaches not merely by classification accuracy but through comprehensive metrics, including balanced accuracy (critical for unbalanced classes), Cohen’s Kappa (accounting for chance agreement), and the detection prevalence (revealing model classification behavior) for a quantitative performance assessment. Dimensionality reduction and careful model selection are necessary to ensure interpretability, stability, and reproducibility of the dataset.
This integrative approach addresses specific challenges in the multivariate classification of food origins. Notably, it considers the trade-offs between model accuracy, stability, and the risks of overfitting, which is particularly relevant for small, unbalanced, and high dimensionality datasets [27,36,37,38,39]. The study also evaluates the impact of dimensionality reduction strategies by contrasting the intrinsic dimension reduction in PLS-DA with the variable selection of PCA. This comparison aims to optimize model interpretability and robustness. By linking computational rigor with domain-specific considerations, including geographic origin, cultivar traits, and environmental variability, our methodological framework advances the chemometric authentication of biological samples and contributes to the best practices of food provenance analytics.

2. Materials and Methods

2.1. Samples Origin, Data Collection, and Analysis

The apple (Malus domestica) samples analyzed in this study were collected by the Research and Breeding Institute of Pomology Holovousy Ltd. (Holovousy, Czech Republic). A total of 28 authentic apple samples with known geographical origins and cultivars were provided over 4 harvest years (2019–2022). The cultivars included in this study were ‘Gala’ and ‘Golden Delicious’, which originated from either the Czech Republic (17 samples from CZ) or Poland (11 samples from PL). The 28 samples originated from 4 districts: East Bohemia (CZ-EaB—13 samples), South Moravia (CZ-SoM—4 samples), Lower Selezian Vojvodeship (PL-LSV—4 samples), and Łódź Voivodeship (PL-LoV—7 samples).
The mineral content of the dry matter in fruits was analyzed for 18 minerals: phosphorus (P), potassium (K), magnesium (Mg), calcium (Ca), boron (B), iron (Fe), manganese (Mn), zinc (Zn), molybdenum (Mo), copper (Cu), sodium (Na), aluminum (Al), lead (Pb), arsenic (As), vanadium (V), cobalt (Co), chromium (Cr), and cadmium (Cd). In terms of isotope ratios, the boron isotope ratio 10B/11B was evaluated. The samples were washed in demineralized water and dried at 50 °C to a constant weight in a laboratory dryer after the droplets of water were evaporated. The fruit samples were then ground into a powder using Grindomix GM 200. The mineral nutrient content and isotope ratios were determined using ICP-MS (Agilent 7900, Agilent Technologies, Inc., Santa Clara, CA, USA) after previous nitric acid digestion using a microwave-digestion system (Discover SP-D 80, CEM Corporation, Matthews, NC, USA). For trace analysis, each sample (0.25 g) was mixed with 6 mL of 65% nitric acid and digested at 200 °C for 4 min. This method was specified by the CEM Corporation and verified by the Central Institute for Supervising and Testing in Agriculture, Czech Republic under the number JPP 40033.1 [40]. The original dataset is attached as the appendix at the end of this article (Appendix A).

2.2. Mathematical and Statistical Approach

Prior to modeling, the obtained mineral profiles were statistically preprocessed using a univariate T-test or a single factorial analysis of variance (T-test/ANOVA) to preselect appropriate diagnostic markers. To this end, the data were analyzed for normality of residuals and homogeneity of variance using the Shapiro–Wilk and Levene tests, respectively. Due to the unequal variance and non-normal distribution of some of the analyzed mineral elements and isotopic ratios, normalization and logarithmic transformation were performed before the analysis of variance. The results of the analysis of variance were then back-transformed using exponential transformation and further compared among the districts using the estimated marginal means test through the “emmeans” library [41].
The adapted mineral profiles were further analyzed using different multivariate tests to reduce dimensionality and allow classification of the samples according to state and district. Binomial and multi-class distribution were calculated for state and district classification, respectively. Prior to the multi-class LDA for districts, principal component analysis (PCA) was used as an exploratory algorithm for discriminant selection and feature reduction. For this purpose, the data were standardized using the center-then-scale method followed by calculation of the contribution of variables. Only the variables with principal component loadings greater than 0.4 for the first two principal components were selected. Then we used the “drop one” method for the further characterization of the feature importance and selection for analyzed LDA models. Furthermore, the dataset was pre-analyzed for the collinearity of the analyzed features using the Variance Inflation Factor (VIF). The results were classified as non-collinear with an VIF < 2, with low collinearity if 2 < VIF < 5 and high collinearity if VIF > 5. The data were further processed using linear discriminant analysis (LDA) and partial least squares discriminant analysis (PLS-DA) to assess the discrimination between/among the particular classes for the two factors. The PLS-DA models were also adapted for both factors by including the weighed centering of the separator (PLS-DAw) due to the unbalanced distribution of samples between or among the analyzed classes.
The Theorem used for the weighed centering was as follows:
σ X j 2 = X . j μ X j 1 W X . j μ X j 1 s
where X j is the column vector for variable j , μ X j = 1 W X j s is its weighted mean, W = d i a g ( w 1 , w 2 , , w n ) is the diagonal matrix of observation weights, s = i w i is the total weight.
The obtained LDA and PLS models were validated using the “leave-one-out” internal cross-validation method. The models were characterized by reporting statistical metrics such as model sensitivity, specificity, detection prevalence, balanced accuracy, p-value and Cohen’s Kappa. The PLS-DA results were characterized by the described variance (R2X and R2Y), the predicted variance (Q2Y), and permutation tests for R2Y and Q2Y. Variable importance was assessed using permutation importance of the selected variables (PI) and variable importance projection (VIP) for the LDA and PLS-DA model, respectively. Variable importance was quantified by permutation importance (PI). For each predictor, we performed 1000 independent random permutations of that predictor across samples (random seed = 42). For each permutation, the trained model was evaluated using leave-one-out cross-validation (LOO-CV), and balanced accuracy was computed. PI for each variable was defined as the median decrease in balanced accuracy (original minus permuted) across the 1000 permutations; the interquartile range (IQR) of these decreases represents the dispersion. The model parameters remained fixed during the permutation runs (no retraining per permutation). For the PLS-DA model, the Variable Importance in Projection (VIP) was computed to quantify the relative contribution of each variable to the model. VIP values were calculated as the weighted sum of squared PLS loadings, proportional to the amount of Y-variance explained by each latent component. Mathematically, the VIP for variable j was expressed as follows:
VIP j = p h = 1 H ( S S Y h S S Y t o t a l w j h 2 )
where p is the total number of predictors, H is the number of PLS components, S S Y h is the variance in Y explained by the h-th component, and w j h is the normalized weight of variable j in that component. Variables with VIP > 1 were considered significant contributors to class discrimination, whereas variables with VIP < 0.8 were regarded as less influential. This approach complements the permutation importance (PI) analysis used for the LDA model.
Figure 1 shows the particular steps of the data processing in consequent order. All statistical analyses were performed in R software version 4.5.1 using the following libraries: “ropls”, “mdatools”, “pls”, “caret”, “irr”, “MASS”, and “ggplot2” [42,43,44,45,46,47,48].

3. Results and Discussion

3.1. Classification Between Two Groups with Unequal Sample Size

The results of the T-test showed a significant difference among the classes for P, B, Mo, Cu, As, and 10B/11B. The VIF test showed only a minor collinearity of variables P = 3.28, K = 2.95, Co = 2.04, and As = 2.07. All the other features demonstrated no collinearity at all. Consequently, these results allow us to maintain all variables to build the LDA models. Initially, the prevalence of the samples in the dataset was 0.607 for the Czech samples (CZ) and 0.393 for the Polish samples (PL). For this classification, four models were calculated: LDA, a reduced LDA-sub model that just kept a subset of variables (B, Mo, and Cu), PLS-DA, and PLS-DAw (with weighted centering of the separator). The detection prevalence for Czech samples with LDA-sub was identical to the initial prevalence of the dataset (Table 1). The detection prevalence of the former LDA was 0.571, while it was substantially lower with both PLS-DA models. Furthermore, the results showed that, after cross-validation, binary LDA and LDA-sub for the dataset using the state as a factor provided models with a very high sensitivity of 0.941 and 1.000 as well as a specificity of 1.000 for both models, respectively. The sensitivities and specificities of PLS-DA and PLS-DAw, were identical and at the same time lower than those of both LDA models. This result was reflected by the high balanced accuracy and Cohen’s Kappa coefficient especially for the LDA-sub model. LDA was the only model that showed significant separation between the two classes.
PLS-DA is considered as an alternative to LDA when sample size is smaller than the number of variables and the dimensionality reduction is required [27,36,39]. PLS-DA aims to project high-dimensional data into a lower-dimensional subspace that maximizes the total covariance between the data vectors and their class membership [49]. One pitfall of this algorithm is that it shifts the separator toward the centroid of the more numerous class, which can provide potentially misleading results when the sample sizes between the classes differ [37]. However, since the mean-centered PLS-DA and weighted mean-centered PLS-DAw models provided the same results, this shift likely did not affected the sample separation in our dataset. Furthermore, our dataset comprises more samples per class than variables (11–17:6) and both permutation importance and variable importance projection confirmed the impact of the variables chosen by ANOVA (P, Mo, Cu, As, B and 10B/11B) on the model performance (Table 2). On the other hand, the selection of variables using the “drop one” method can further improve the reliability of those models. The most important variables were copper, boron, and molybdenum, while arsenic, phosphorus, and the boron isotopic ratio 10B/11B seemed to be less important variables. These facts promote the quality performance of our LDA model with only one component, which provides a more reliable classification of the samples between two states (Figure 2 and Figure 3), as opposed to the two PLS-DA models. Since the PLS-DA algorithm is known to perform differently than LDA when only one component is used [37], it is likely that LDA becomes more reliable when the dataset is small with a relatively narrow class distribution and only one component.

3.2. Classification Between Multiple Groups with Unequal Sample Size

Data preprocessing using ANOVA revealed significant differences among the classes with P, K, B, Mn, Co, Mo, Cu, As, 10B/11B. Multiple group classifications were calculated for four different districts using LDA and PLS-DA models (Table 3). The initial prevalence (proportion of samples per district) of the dataset was 13 samples for CZ-EaB (0.464), 4 for CZ-SoM (0.143), 7 for PL-LoV (0.250), and 4 for PL-LSV (0.143). All the models returned three significant components. The problem was the low number of samples per class compared to the relatively high number of variables (4-13:9) identified by the ANOVA test. This is an obvious issue when calculating LDA because, in such cases, the algorithm is susceptible to overestimation of the model [28,36]. To illustrate the results, we calculated a former LDA model and a reduced LDA-sub model that kept just a subset of variables (P, B, Mn, Cu), which were obtained by the PCA dimension reduction and further “drop one” variable selection, as described in the Materials and Methods Section. The selected variables are in some contrast with results of the variables permutation importance calculated for LDA (Table 4). Both LDA models consistently demonstrated a higher sensitivity for the CZ-EaB and PL-LoV classes, whereas sensitivity was only 50% for the CZ-SoM class. Moreover, the greatest difference between the LDA and LDA-sub models was observed in the CZ-EaB and PL-LSV class. The balanced accuracy of the LDA-sub model yielded slightly higher results, like those found for the sensitivity. On the other hand, the LDA-sub model had a detection prevalence similar to that found in the former LDA. Consequently, the variable selection through the PCA component reduction with the “drop one” variable selection proved to rationalize the LDA model performance, as recommended by many authors [22,23], but the small dataset may compromise the model’s reliability for sample classification. Comparing the results of LDA and PLS-DA reveals a significant increase in the overall accuracy, particularly due to the improved sensitivity of the PLS-DA models, which ranges from 0.786 to 0.929 (Table 3). To understand the difference, it is important to note that the LDA algorithm provides results of linear combinations of predictors that maximize between-class variance and minimize within-class variance. In contrast, PLS finds latent components that maximize the covariance between predictors and the class indicator matrix [27,50]. The PLS algorithm incorporates the dimension reduction, which depends on the between-groups sums-of-squares and the cross-product matrix to information on reducing dimension. PCA relies on the sample (total) variance/covariance matrix [27]. Therefore, it is suggestive that a decreased number of true samples per class in small datasets enhances the portion of variability (Figure 4). In particular cases, this may potentially compromise the stability [36] and accuracy of the LDA model [27,28]. Nevertheless, when we examine the detection prevalence of all four models, the results of LDA-sub model were the closest to those identified in the original dataset. The PLS-DA model algorithm looks for the variables that correlate best with the classifier. In a small dataset, this may lead to correlations that are just by chance [36]. Although this algorithm can cope with a higher number of variables than samples [39], there is a risk of overoptimistic results [37]. In our study, it is thus evident that PLS-DA provides higher model sensitivity but correctly classifies only three of the four classes (Figure 5). After weighting of the center mean, the PLS-DAw model decreased the model detection prevalence allowing differentiation of only two of the four classes. Consequently, the PLS-DA model may provide higher accuracy, but it carries a higher risk of lower stability in cases of small, unbalanced datasets with relatively close sample distributions among the observed classes. Therefore, the one-sided use of the misclassification rate as the basic tool for evaluating model performance should be approached with caution.

4. Conclusions

Building a reliable classification model requires appropriate data preprocessing as a foundational step (Figure 1). This includes selecting initial variables through univariate tests (T-test/ANOVA), multivariate approaches (PCA), or other complementary approaches for variable selection to reduce dimensionality according to the ratio of the number of samples versus the number of variables and the intended classification algorithm. Model selection depends on both data quality and algorithm-specific performance characteristics. Rigorous cross-validation is essential for the valid interpretation of model outputs. Model performance and reliability should be assessed not only through accuracy metrics, misclassification rates, statistical significance, and detection prevalence, the meaning of which provides insight into the underlying classification structure. For small, unbalanced datasets with closely distributed classification clusters, LDA consistently produces more reliable models, though not necessarily with higher apparent accuracy. In single-component scenarios, PLS-DA fails to match LDA performance. Therefore, LDA should be prioritized when computationally feasible. Even multi-class PLS-DA models with an equivalent number of significant components require cautious interpretation when applied to such datasets. Successful interpretation and generalization of model results require a consideration of model stability and reproducibility within the broader experimental context. Specifically, factors such as the geographical origin of the samples, the selection of species and cultivars, and agricultural management practices can substantially influence the mineral composition of fruit, thereby altering the discriminatory importance of analyzed elements and isotopic ratios in the classification framework. Our work has an algorithmic and statistical contribution because it addresses the selection of appropriate methods for mathematically non-ideal conditions, which is a fundamental problem in modern scientific statistics and machine learning in a world of mathematically non-ideal but real—natural—conditions.

Author Contributions

Conceptualization, M.M. and J.S.; methodology, M.M., J.S., T.B. and A.V.; software, M.M.; validation, M.M., T.B. and A.V.; formal analysis, M.M.; investigation, J.S.; resources, J.S.; data curation, M.M. and J.S.; writing—original draft preparation, M.M., J.S., T.B. and A.V.; writing—review and editing, M.M. and J.S.; visualization, M.M.; supervision, J.S.; project administration, J.S.; funding acquisition, J.S. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by Ministry of Agriculture Czech Republic (grant numbers RO1525 and NAZV QK1910104).

Data Availability Statement

The raw data supporting the conclusions of this article will be made available by the authors on request.

Acknowledgments

We thank František Švec for the English proofreading. We thank Matěj Semerák for technical help with the formatting of the article.

Conflicts of Interest

The authors declare no conflicts of interest. All authors are employes of the Research and Breeding Institute of Pomology Holovousy Ltd. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Appendix A

Table A1. Dataset of samples mineral profiles resulting from ICP-MS of apples gathered in 2019–2022.
Table A1. Dataset of samples mineral profiles resulting from ICP-MS of apples gathered in 2019–2022.
PKBMnCuCoAsMoB1011LokalitaState
567.02257314.24311.370273.236512.492510.01440.026320.079840.1808CZ-SoMCZ
426.81877104.6986.072673.377181.882540.011740.021280.060240.182PL-LoVPL
562.51948042.6717.857813.714582.03860.007920.023880.063350.2015PL-LoVPL
613.1227923.647.945413.807851.208590.0080.019410.059440.1843PL-LoVPL
436.12355554.11214.096811.293521.330920.00420.018740.034120.1823PL-LSVPL
587.91156395.02817.670482.997261.565710.015690.0360.070720.183CZ-EaBCZ
714.33547889.2815.206563.592872.433520.005170.022390.059680.2009CZ-EaBCZ
636.31137306.94816.111352.852191.69980.004420.020320.087370.227CZ-EaBCZ
548.20056330.34413.257362.046122.193650.011640.018590.074360.221CZ-SoMCZ
608.82516790.08812.488652.236841.868870.002720.016150.084250.213CZ-EaBCZ
585.54386148.05618.946181.991781.532780.102020.045840.045940.223CZ-EaBCZ
711.86217864.70715.591411.948462.287180.007180.027920.126210.2096CZ-EaBCZ
455.99136325.8998.575091.669621.378180.008140.02380.041760.1915PL-LSVPL
662.52358427.5866.940063.021361.128050.005870.019880.050410.1893PL-LoVPL
491.02736271.04610.186242.000481.682660.009730.028580.083590.1806CZ-EaBCZ
489.69186059.4928.827462.50812.771630.024820.03580.082390.1815CZ-SoMCZ
513.38928958.22612.65082.946442.089150.004450.02520.039320.2021PL-LoVPL
484.81527188.74211.545413.041171.172560.008150.018510.070940.1832PL-LoVPL
438.48066240.84713.667471.948961.745490.037170.017270.046030.1827PL-LSVPL
530.87466736.30120.835433.999581.552710.014670.033680.033770.1905CZ-EaBCZ
734.96678666.11116.48173.139252.589110.004490.024590.040350.2008CZ-EaBCZ
575.37697191.59122.138322.609212.198070.003340.020270.043120.224CZ-EaBCZ
484.92516108.11710.512932.170311.815530.008010.017670.084460.2CZ-SoMCZ
677.71269169.34613.539652.823481.430750.00510.02330.076310.228CZ-EaBCZ
606.80757597.72418.658383.018451.266880.024090.042330.081460.225CZ-EaBCZ
630.32626904.6413.238872.141491.499260.005230.031320.095430.1966CZ-EaBCZ
365.96686396.27511.964651.983251.577320.007570.024340.041110.193PL-LSVPL
429.33237065.086.895633.160381.012860.007760.025520.048010.1903PL-LoVPL

References

  1. Kelly, S.; Heaton, K.; Hoogewerff, J. Tracing the Geographical Origin of Food: The Application of Multi-Element and Multi-Isotope Analysis. Trends Food Sci. Technol. 2005, 16, 555–567. [Google Scholar] [CrossRef]
  2. Dasenaki, M.E.; Thomaidis, N.S. Quality and Authenticity Control of Fruit Juices—A Review. Molecules 2019, 24, 1014. [Google Scholar] [CrossRef]
  3. Nguyen, Q.T.; Nguyen, T.T.; Le, V.N.; Nguyen, N.T.; Truong, N.M.; Hoang, M.T.; Pham, T.P.T.; Bui, Q.M. Towards a Standardized Approach for the Geographical Traceability of Plant Foods Using Inductively Coupled Plasma Mass Spectrometry (ICP-MS) and Principal Component Analysis (PCA). Foods 2023, 12, 1848. [Google Scholar] [CrossRef]
  4. Rajapaksha, D.; Waduge, V.; Padilla-Alvarez, R.; Kalpage, M.; Rathnayake, R.M.N.P.; Migliori, A.; Frew, R.; Abeysinghe, S.; Abrahim, A.; Amarakoon, T. XRF to support food traceability studies: Classification of Sri Lankan tea based on their region of origin. X-Ray Spectrom. 2017, 46, 220–224. [Google Scholar] [CrossRef]
  5. Obeidat, S.M.; Hammoudeh, A.Y.; Alomary, A.A. Application of FTIR Spectroscopy for Assessment of Green Coffee Beans According to Their Origin. J. Appl. Spectrosc. 2018, 84, 1051–1055. [Google Scholar] [CrossRef]
  6. Lim, C.M.; Carey, M.; Williams, P.N.; Koidis, A. Rapid classification of commercial teas according to their origin and type using elemental content with X-ray fluorescence (XRF) spectroscopy. Curr. Res. Food Sci. 2021, 4, 45–52. [Google Scholar] [CrossRef]
  7. Mazarakioti, E.C.; Karavoltsos, S.; Sakellari, A.; Kourou, M.; Sakellari, A.; Dassenakis, E. Inductively Coupled Plasma–Mass Spectrometry (ICP-MS), a Useful Tool in Authenticity of Agricultural Products’ and Foods’ Origin. Foods 2022, 11, 3705. [Google Scholar] [CrossRef]
  8. Mo, R.; Zheng, Y.; Ni, Z.; Shen, D.; Liu, Y. The Phytochemical Components of Walnuts and Their Application for Geographical Origin Based on Chemical Markers. Food Qual. Saf. 2022, 6, fyac052. [Google Scholar] [CrossRef]
  9. Elefante, A.; Giglio, M.; Mongelli, L.; Bux, A.; Zifarelli, A.; Menduni, G.; Patimisco, P.; Caratti, A.; Cagliero, C.; Liberto, E.; et al. Spectroscopic Study of Volatile Organic Compounds for the Assessment of Coffee Authenticity. Molecules 2025, 30, 3487. [Google Scholar] [CrossRef]
  10. Krška, B.; Mészáros, M.; Bílek, T.; Vávra, A.; Náměstek, J.; Sedlák, J. Analysis of Mineral Composition and Isotope Ratio as Part of Chemical Profiles of Apples for Their Authentication. Agronomy 2024, 14, 2703. [Google Scholar] [CrossRef]
  11. Francini, A.; Fidalgo-Illesca, C.; Raffaelli, A.; Sebastiani, L. Phenolics and Mineral Elements Composition in Underutilized Apple Varieties. Horticulturae 2022, 8, 40. [Google Scholar] [CrossRef]
  12. Müller, M.-S.; Oest, M.; Scheffler, S.; Horns, A.L.; Paasch, N.; Bachmann, R.; Fischer, M. Food Authentication Goes Green: Method Optimization for Origin Discrimination of Apples Using Apple Juice and ICP-MS. Foods 2024, 13, 3783. [Google Scholar] [CrossRef] [PubMed]
  13. Fotirić Akšić, M.; Nešović, M.; Ćirić, I.; Tešić, Ž.; Pezo, L.; Tosti, T.; Gašić, U.; Dojčinović, B.; Lončar, B.; Meland, M. Polyphenolics and Chemical Profiles of Domestic Norwegian Apple (Malus × domestica Borkh.) Cultivars. Front. Nutr. 2022, 9, 941487. [Google Scholar] [CrossRef] [PubMed]
  14. Zhang, J.; Shen, Y.; Ma, N.; Xu, G. Authentication of apples from the Loess Plateau in China based on interannual element fingerprints and multidimensional modelling. Food Chem. 2023, 20, 100948. [Google Scholar] [CrossRef]
  15. Bechynska, K.; Sedlak, J.; Uttl, L.; Kosek, V.; Vackova, P.; Kocourek, V.; Hajslova, J. Metabolomics on Apple (Malus domestica) Cuticle—Search for Authenticity Markers. Foods 2024, 13, 1308. [Google Scholar] [CrossRef]
  16. Ballabio, C.; Lugato, E.; Fernández-Ugalde, O.; Orgiazzi, A.; Jones, A.; Borrelli, P.; Montanarella, L.; Panagos, P. Mapping LUCAS Topsoil Chemical Properties at European Scale Using Gaussian Process Regression. Geoderma 2019, 355, 113912. [Google Scholar] [CrossRef]
  17. Wang, F.; Wu, X.; Ding, Y.; Liu, X.; Wang, X.; Gao, Y.; Tian, J.; Li, X. Study of the Effects of Spraying Non-Bagging Film Agent on the Contents of Mineral Elements and Flavonoid Metabolites in Apples. Horticulturae 2024, 10, 198. [Google Scholar] [CrossRef]
  18. Mandache, M.B.; Cosmulescu, S. Mineral Content of Apple, Sour Cherry and Peach Pomace and the Impact of Their Application on Bakery Products. Foods 2025, 14, 3146. [Google Scholar] [CrossRef]
  19. Jolliffe, I.T.; Cadima, J. Principal component analysis: A review and recent developments. Philos. Trans. R. Soc. A Math. Phys. Eng. Sci. 2016, 374, 20150202. [Google Scholar] [CrossRef]
  20. Truzzi, E.; Marchetti, L.; Piazza, D.V.; Bertelli, D. Multivariate Statistical Models for the Authentication of Traditional Balsamic Vinegar of Modena and Balsamic Vinegar of Modena on 1H-NMR Data: Comparison of Targeted and Untargeted Approaches. Foods 2023, 12, 1467. [Google Scholar] [CrossRef]
  21. Sotiropoulou, N.S.; Xagoraris, M.; Revelou, P.K.; Kaparakou, E.; Kanakis, C.; Pappas, C.; Tarantilis, P. The Use of SPME-GC-MS IR and Raman Techniques for Botanical and Geographical Authentication and Detection of Adulteration of Honey. Foods 2021, 10, 1671. [Google Scholar] [CrossRef] [PubMed]
  22. Karadžić Banjac, M.; Kovačević, S.; Podunavac-Kuzmanović, S. Ongoing Multivariate Chemometric Approaches in Bioactive Compounds and Functional Properties of Foods—A Systematic Review. Processes 2024, 12, 583. [Google Scholar] [CrossRef]
  23. Li, W.; Zhao, C.; Zhang, Y.; Wang, X.; Chen, Y.; Liu, D. Hyperspectral Imaging for Foreign Matter Detection in Foods: Combining PCA and LDA Models. Foods 2025, 14, 3026. [Google Scholar] [CrossRef]
  24. McLachlan, G.J. Discriminant Analysis and Statistical Pattern Recognition; Wiley: Hoboken, NJ, USA, 2004. [Google Scholar]
  25. Hou, Z.; Jin, Y.; Gu, Z.; Zhang, R.; Su, Z.; Liu, S. 1H NMR Spectroscopy Combined with Machine-Learning Algorithm for Origin Recognition of Chinese Famous Green Tea Longjing Tea. Foods 2024, 13, 2702. [Google Scholar] [CrossRef]
  26. Varrà, M.O.; Ghidini, S.; Husáková, L.; Ianieri, A.; Zanardi, E. Advances in Troubleshooting Fish and Seafood Authentication by Inorganic Elemental Composition. Foods 2021, 10, 270. [Google Scholar] [CrossRef] [PubMed]
  27. Barker, W.; Rayens, W. Partial least squares for discrimination. J. Chemom. 2003, 17, 166–173. [Google Scholar] [CrossRef]
  28. Hamid, H.; Zainon, F.; Yong, T.P. Performance analysis: An integration of principal component analysis and linear discriminant analysis for a very large number of measured variables. Res. J. Appl. Sci. 2016, 11, 1422–1426. [Google Scholar]
  29. Barbosa, S.; Saurina, J.; Puignou, L.; Núñez, O. Classification and Authentication of Paprika by UHPLC-HRMS Fingerprinting and Multivariate Calibration Methods (PCA and PLS-DA). Foods 2020, 9, 486. [Google Scholar] [CrossRef]
  30. Zhang, H.; Wu, L.; Li, D.; Li, J.; Wang, C.; Chen, J. Characterization and Discrimination of Apples by Flash GC E-Nose. Foods 2022, 11, 1631. [Google Scholar]
  31. Breiman, L. Random Forests. Mach. Learn. 2001, 45, 5–32. [Google Scholar] [CrossRef]
  32. Friedman, J.H. Greedy Function Approximation: A Gradient Boosting Machine. Ann. Stat. 2001, 29, 1189–1232. [Google Scholar] [CrossRef]
  33. Kim, J.-H. Estimating classification error rate: Repeated cross-validation, repeated hold-out and bootstrap. Comput. Stat. Data Anal. 2009, 53, 3735–3745. [Google Scholar] [CrossRef]
  34. Papadopoulou, O.S.; Pappa, E.C.; Goliopoulos, A.; Lioliou, A.; Kontakos, S.; Papadopoulou, S.K. Chemometric Classification of Feta Cheese Authenticity via ATR-FTIR Spectroscopy. Appl. Sci. 2023, 15, 8272. [Google Scholar] [CrossRef]
  35. Lytovchenko, A.; Stepanova, N.; Shapoval, O.; Skoryk, M.; Korchynska, L.; Ostapchuk, A.; Hovorun, D. Authentication of Laying Hen Housing Systems Based on Egg Yolk Using 1H NMR Spectroscopy and Machine Learning. Foods 2025, 13, 1098. [Google Scholar] [CrossRef]
  36. Brereton, R.G. Consequences of sample size, variable selection, and model validation and optimisation, for predicting classification ability from analytical data. Trends Anal. Chem. 2006, 25, 11. [Google Scholar] [CrossRef]
  37. Brereton, R.G.; Lloyd, G.R. Partial least squares discriminant analysis: Taking the magic away. J. Chemom. 2014, 28, 213–225. [Google Scholar] [CrossRef]
  38. Hoyle, C.H. Automatic PCA Dimension Selection for High Dimensional Data and Small Sample Sizes. J. Mach. Learn. Res. 2008, 9, 2733–2759. Available online: https://www.jmlr.org/papers/volume9/hoyle08a/hoyle08a.pdf (accessed on 10 September 2025).
  39. Rashid, N.A.; Hussain, W.S.E.C.; Ahmad, A.R.; Abdullah, F.N. Performance of Classification Analysis: A Comparative Study between PLS-DA and Integrating PCA+LDA. Math. Stat. 2019, 7, 24–28. [Google Scholar] [CrossRef]
  40. Zbíral, J. Analýza Rostlinného Materiálu: Jednotné Pracovní Postupy, 3rd ed.; ÚKZÚZ: Brno, Czech Republic, 2014. [Google Scholar]
  41. Lenth, R. emmeans: Estimated Marginal Means, aka Least-Squares Means; R package version 1.10.6. 2024. Available online: https://CRAN.R-project.org/package=emmeans (accessed on 9 October 2025).
  42. Thevenot, E.A.; Roux, A.; Xu, Y.; Ezan, E.; Junot, C. Analysis of the Human Adult Urinary Metabolome Variations with Age, Body Mass Index and Gender by Implementing a Comprehensive Workflow for Univariate and OPLS Statistical Analyses. J. Proteome Res. 2015, 14, 3322–3335. [Google Scholar] [CrossRef] [PubMed]
  43. Kucheryavskiy, S. mdatools—R Package for Chemometrics. Chemom. Intell. Lab. Syst. 2020, 198, 103937. [Google Scholar] [CrossRef]
  44. Liland, K.; Mevik, B.; Wehrens, R. pls: Partial Least Squares and Principal Component Regression; R Package Version 2.8-5. 2024. Available online: https://CRAN.R-project.org/package=pls (accessed on 9 October 2025).
  45. Kuhn, M. Building Predictive Models in R Using the caret Package. J. Stat. Softw. 2008, 28, 1–26. [Google Scholar] [CrossRef]
  46. Gamer, M.; Lemon, J. irr: Various Coefficients of Interrater Reliability and Agreement; R Package Version 0.84.1. 2019. Available online: https://CRAN.R-project.org/package=irr (accessed on 9 October 2025).
  47. Venables, W.N.; Ripley, B.D. Modern Applied Statistics with S, 4th ed.; Springer: New York, NY, USA, 2002; ISBN 0-387-95457-0. [Google Scholar]
  48. Wickham, H. ggplot2: Elegant Graphics for Data Analysis; Springer: New York, NY, USA, 2016. [Google Scholar]
  49. Ahmad, N.A. Numerically stable locality-preserving partial least squares discriminant analysis for efficient dimensionality reduction and classification of high-dimensional data. Heliyon 2024, 10, e26157. [Google Scholar] [CrossRef] [PubMed]
  50. Hastie, T.; Friedman, J.; Tibshirani, R. The Elements of Statistical Learning-Data Mining, Inference, and Prediction, 1st ed.; Springer Nature: New York, NY, USA, 2001; ISBN 978-0-387-21606-5. [Google Scholar]
Figure 1. Algorithmic workflow for chemometric data processing and supervised classification. It integrates the following algorithms for multivariate feature extraction, model optimization, and validation: Principal Component Analysis (PCA), Linear Discriminant Analysis (LDA), and Partial Least Squares Discriminant Analysis (PLS-DA). The color coding indicates: blue boxes—input data; green boxes—processing steps including preprocessing and transformation procedures; yellow boxes—classification decision points (binary vs. multi-class); red boxes—final discriminant models.
Figure 1. Algorithmic workflow for chemometric data processing and supervised classification. It integrates the following algorithms for multivariate feature extraction, model optimization, and validation: Principal Component Analysis (PCA), Linear Discriminant Analysis (LDA), and Partial Least Squares Discriminant Analysis (PLS-DA). The color coding indicates: blue boxes—input data; green boxes—processing steps including preprocessing and transformation procedures; yellow boxes—classification decision points (binary vs. multi-class); red boxes—final discriminant models.
Algorithms 18 00733 g001
Figure 2. Histogram of (A) LDA and (B) LDA-sub scores of the discriminatory functions for the Czech and Polish samples.
Figure 2. Histogram of (A) LDA and (B) LDA-sub scores of the discriminatory functions for the Czech and Polish samples.
Algorithms 18 00733 g002
Figure 3. Orthogonal distance, regression coefficients, misclassification rate, and the predictions plot of the first component for the cross-validated PLS-DAw model used for the country classification.
Figure 3. Orthogonal distance, regression coefficients, misclassification rate, and the predictions plot of the first component for the cross-validated PLS-DAw model used for the country classification.
Algorithms 18 00733 g003
Figure 4. Score plots (A) of the LDA (left) and LDA-sub (right) models accompanied by group means, confidence intervals, and cross-validation (LOO-CV) results, as well as histograms (B) of both LDA discriminant scores of the first discriminatory functions for particular district.
Figure 4. Score plots (A) of the LDA (left) and LDA-sub (right) models accompanied by group means, confidence intervals, and cross-validation (LOO-CV) results, as well as histograms (B) of both LDA discriminant scores of the first discriminatory functions for particular district.
Algorithms 18 00733 g004
Figure 5. Orthogonal distance, regression coefficients, misclassification rate, and the predictions plot for all three non-zero components of the cross-validated (A) PLS-DA and (B) PLS-DAw models used for the district classification.
Figure 5. Orthogonal distance, regression coefficients, misclassification rate, and the predictions plot for all three non-zero components of the cross-validated (A) PLS-DA and (B) PLS-DAw models used for the district classification.
Algorithms 18 00733 g005
Table 1. Comparison of the model sensitivity, specificity, detection prevalence, balanced accuracy, p-value, and Cohen’s Kappa of the binary models LDA, PLS-DA and weighted PLS-DA (PLS-DAw) for the Czech samples class.
Table 1. Comparison of the model sensitivity, specificity, detection prevalence, balanced accuracy, p-value, and Cohen’s Kappa of the binary models LDA, PLS-DA and weighted PLS-DA (PLS-DAw) for the Czech samples class.
LDALDAsubPLS-DAPLS-DAw
Sensitivity0.9411.0000.8240.824
Specificity1.0001.0000.6360.636
Bal. accuracy0.9711.0000.7010.701
Detec. prevalence0.5710.6070.5000.500
p-value/pR2Y/pQ2Y<0.001<0.0010.1670.167
Kappa0.9261.0000.4010.401
Table 2. Permutation importance (PI) of the selected variables and the variable importance projection (VIP) for the LDA and PLS-DA models are described with the median and the interquartile range (IQR).
Table 2. Permutation importance (PI) of the selected variables and the variable importance projection (VIP) for the LDA and PLS-DA models are described with the median and the interquartile range (IQR).
VariableLDA ModelVariablePLS-DA Model
PI MedianIQRVIP MedianIQRFreq_VIP
P0.14290.0714B1.39240.12921.00
Mo0.07140.0714P1.21110.19091.00
B0.03580.035710B/11B1.10260.11060.80
Cu0.03570.0357Mo1.06750.27031.00
As0.03570.0357Cu1.06010.12960.60
10B/11B0.03570.0357As0.96660.05230.20
Table 3. Comparison of the model sensitivity, specificity, detection prevalence, balanced accuracy, p-value, and Cohen’s Kappa of the multi-class models LDA, LDA-sub (model with a subset of variables), PLS-DA, and weighted PLS-DA (PLS-DAw) for the classes of the four sampled districts.
Table 3. Comparison of the model sensitivity, specificity, detection prevalence, balanced accuracy, p-value, and Cohen’s Kappa of the multi-class models LDA, LDA-sub (model with a subset of variables), PLS-DA, and weighted PLS-DA (PLS-DAw) for the classes of the four sampled districts.
ModelDistrictsSensitivitySpecificityDetec. PrevalenceBal. Accuracyp-ValueKappa
LDACZ-EaB0.6920.8670.3930.7800.0070.592
CZ-SoM0.5000.9170.1430.708
PL-LoV0.8570.9050.2860.881
PL-LSV0.7500.9170.1790.833
LDA-subCZ-EaB0.9230.9330.4640.928<0.0010.791
CZ-SoM0.5000.9580.1070.729
PL-LoV0.8571.0000.2140.929
PL-LSV1.0000.9170.2140.958
PLS-DACZ-EaB0.8930.9330.3920.913<0.0010.895
CZ-SoM0.7860.9170.0000.851
PL-LoV0.9290.9520.2140.941
PL-LSV0.9290.9580.1070.944
PLS-DAwCZ-EaB0.9230.9330.4290.9290.0410.780
CZ-SoM0.0001.0000.0000.857
PL-LoV0.8570.9050.2140.893
PL-LSV0.0001.0000.0000.857
Table 4. Permutation importance of the selected variables (PI) and variable importance projection (VIP) for the LDA and PLS-DA models are described with the median and interquartile range (IQR).
Table 4. Permutation importance of the selected variables (PI) and variable importance projection (VIP) for the LDA and PLS-DA models are described with the median and interquartile range (IQR).
VariableLDA ModelVariablePLS-DA Model
PI MedianIQRVIP MedianIQRFreq_VIP
K6.08927.5709B1.34530.11120.95
P5.13796.3081Mn1.23930.12511.00
Mn4.74014.1554P1.23720.10490.96
Co4.50248.0422K1.14430.12390.01
B4.16564.418710B/11B0.95280.14031.00
Mo4.00344.1890As0.77320.16950.03
As3.51514.4595Mo0.77150.20220.02
Cu3.47243.2303Cu0.65870.27220.02
10B/11B3.43694.1250Co0.37430.11840.32
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Mészáros, M.; Sedlák, J.; Bílek, T.; Vávra, A. Evaluating LDA and PLS-DA Algorithms for Food Authentication: A Chemometric Perspective. Algorithms 2025, 18, 733. https://doi.org/10.3390/a18120733

AMA Style

Mészáros M, Sedlák J, Bílek T, Vávra A. Evaluating LDA and PLS-DA Algorithms for Food Authentication: A Chemometric Perspective. Algorithms. 2025; 18(12):733. https://doi.org/10.3390/a18120733

Chicago/Turabian Style

Mészáros, Martin, Jiří Sedlák, Tomáš Bílek, and Aleš Vávra. 2025. "Evaluating LDA and PLS-DA Algorithms for Food Authentication: A Chemometric Perspective" Algorithms 18, no. 12: 733. https://doi.org/10.3390/a18120733

APA Style

Mészáros, M., Sedlák, J., Bílek, T., & Vávra, A. (2025). Evaluating LDA and PLS-DA Algorithms for Food Authentication: A Chemometric Perspective. Algorithms, 18(12), 733. https://doi.org/10.3390/a18120733

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop