Skip to Content
SeparationsSeparations
  • Article
  • Open Access

25 September 2026

19 Pages

A Data-Driven Approach for Extracting and Characterizing Chemical Attributes of Mango Fruit

,
and
1
Department of Mathematics, College of Science, King Khalid University, Abha 62223, Saudi Arabia
2
Department of Mathematical Sciences, College of Science, Princess Nourah bint Abdulrahman University, P.O. Box 84428, Riyadh 11671, Saudi Arabia
*
Author to whom correspondence should be addressed.

Abstract

Mango fruit is widely recognized for its substantial nutritional value and its contribution to a balanced diet. It is an excellent source of vitamin C, vitamin A, and dietary fiber that facilitates digestive function. This fruit also provides many important minerals, including potassium and magnesium, and it is rich in bioactive compounds, particularly polyphenols. It is an important tropical fruit crop widely cultivated in Saudi Arabia, especially in the southwestern regions, where climatic conditions are favorable for its production. In this paper, we propose novel techniques for analyzing the nutritional composition and quality attributes of mango. The approach integrates spectroscopic techniques with advanced statistical modeling to evaluate and predict the quality attributes of mango. Specifically, we employ some functional regression methods, including least squares relative error regression(LSRE), least absolute relative error regression (LARE), and functional least absolute deviations regression (FLAD), to predict important indicators such as vitamin C content, soluble solids content (SSC), and total acidity (TA). The results demonstrate that these functional approaches outperform conventional methods, such as partial least squares regression (PLSR) and principal component regression (PCR), in terms of predictive accuracy. Furthermore, the proposed models exhibit strong robustness, which maintains reliable performance under heterogeneous and non-normal data conditions, highlighting their suitability for practical applications in fruit quality assessment.

1. Introduction

Mango is one of the major fruit crops cultivated in Saudi Arabia, particularly in the southwestern regions, where climatic conditions are favorable for its growth. It is important for rural development and the diversification of the Kingdom’s agricultural economy. For more discussion on mango cultivation in Saudi Arabia, we refer the reader to Almarri et al. [1], who provide a comprehensive review of the characteristics, genetic diversity, and population structure of mango germplasm, together with valuable insights for improving mango production under arid environmental conditions. In addition to its economic importance, mango is distinguished by its dense and diverse nutritional composition, making it a valuable component of a healthy diet. It is particularly rich in vitamin C, which contributes to immune resilience and cellular protection. It also contains vitamin A, which is essential for visual function and epithelial health. Moreover, mango is an important source of dietary fiber, promoting gastrointestinal function and assisting in glycemic regulation. In addition to these nutrients features, mango contains a variety of phytochemicals, including polyphenolic compounds and flavonoids, which exhibit strong antioxidant and anti-inflammatory activities. Despite its natural sweetness, mango is low in soluble solids content SSC and provides a readily available source of energy (see Swaroop et al. [2] and Kumar et al. [3] for an overview on the phytochemical composition, nutritional value, and health-promoting properties of mangoes). Consequently, regular consumption of mango, within a balanced dietary regime, may contribute to overall health maintenance and the reduction of chronic disease risk. Therefore, accurate prediction of the chemical constituents and nutritional composition of this fruit is essential for evaluating its quality and for optimizing its production. The aim of this paper is to provide a prototype of digital tools that allow real-time control of mango quality through the prediction of the mentioned chemical components. The algorithm of this software tool is based on a data-driven approach that combines the NIR spectroscopic technologies with advanced functional statistical modeling.
Historically, the application of near-infrared (NIR) spectroscopy as a rapid and non-destructive technique for evaluating the nutritional properties of fruits was investigated by Liu et al. [4]. In this cited work, NIR spectral data were employed to predict soluble solids content (SSC) and acidity in ‘Fuji’ apples. The spectra were acquired via fiber-optic instrumentation and a specially designed sample holder. Lin et al. [5] provide a comprehensive overview of the theoretical foundations of NIR analysis for fruit quality assessment. It demonstrates that appropriate analysis of NIR spectra can yield meaningful tools for fruit quality attributes. An extensive review of the development of NIR spectroscopy (NIRS) in both internal and external quality evaluation of citrus fruits is presented in Magwaza et al. [6]. The latter discussed the principal aspects such as the selection of spectral regions, data acquisition, and interpretation. It gives the theoretical background, historical evolution, and chemometric techniques associated with NIRS. Concerning the mango fruit, Lamptey et al. [7] investigated the feasibility of using a handheld NIR spectrometer operating in the wavelength range of 740–1070 nm, integrated with multivariate algorithms and smartphone technology, to classify varieties and assess fruit maturity. In addition, Rahman et al. [8] and Wang et al. [9] highlight the growing interest in using some alternative non-destructive techniques such as machine vision, hyperspectral imaging, and fluorescence imaging for evaluating the quality of major fruits and vegetables. Recent advancements in this field are discussed in Zhou et al. [10], which reports additional findings on NIR-based quality analysis of ‘Harlikar’ apples.
Clearly, the NIR processing usually requires some statistical algorithms as reported in [11]. These approaches include ridge regression, principal component regression, projection pursuit regression, spike-and-slab regression, as well as ensemble and nonlinear techniques such as random forests, boosting, neural networks, and model averaging. In addition, the study applied several classification methods, including partial least squares (PLS) discriminant analysis, random forests, boosting, and support vector machines (SVM). For a more comprehensive discussion on the reliability of near-infrared (NIR) spectroscopy in food industry applications, the reader is referred to Evangeslista et al. [11] and the references cited therein.
The novelty of the present work is linked to the application of functional statistical methods to model spectroscopic data, offering an alternative to conventional multivariate approaches such as multiple linear regression (MLR), principal component regression (PCR), and partial least squares (PLS). Functional data analysis (FDA), a relatively recent area of statistics, treats observations as continuous curves or functions rather than discrete measurements. This framework is particularly well suited to spectroscopic data as it naturally accommodates their functional structure and provides an effective approach for handling high-dimensional information. Such statistical models have been investigated by Aguilera [12] for calibration and classification tasks in chemometrics, where observations are naturally viewed as functional data. We refer to Ferraty et al. [13] for a more detailed treatment of functional statistical methods in spectrometric analysis. In an applied context, Almanjahie et al. [14] employed functional models combined with quantile regression to predict the chemical composition of forage, achieving accurate estimates for acid detergent fiber, neutral detergent fiber, and crude protein. Similarly, Almanjahie et al. [15] utilized nonparametric functional data analysis such as kernel-based functional quantile and expectile estimators, as well as semi-partial linear models to predict the chemical composition of corn and cookie dough using NIR spectroscopy. Additional theoretical developments in the application of functional statistics to food quality and spectrometry data can be found in Almulhim et al. [16] and Acar-Denizli et al. [17].
In this contribution, we propose the use of Near-Infrared Spectroscopy (NIRS) as a modern analytical tool for developing a novel framework to predict the chemical composition of mango fruits. The proposed methodology is based on a new functional regression framework that incorporates the concept of a relative error loss function. This prediction approach offers several advantages over classical functional regression methods. Firstly, by representing each spectrum as a functional object, the proposed models effectively capture the smooth and highly correlated structure of spectral data, thereby preserving the information contained in the curves and improving prediction accuracy and stability. Secondly, unlike conventional regression methods, which are typically based on mean square prediction errors, our approach focuses on relative error regression. This criterion provides a scale-independent measure of prediction accuracy and is particularly appropriate when the response variable exhibits substantial variability. Consequently, the proposed framework addresses several limitations of traditional regression techniques. Specifically, we investigate three robust functional regression methods: Functional Least Squares Relative Error Regression (FLSR), Functional Least Absolute Relative Error Regression (FLAR), and Functional Least Absolute Deviations Regression (FLAD). The predictive performance of these models is evaluated for estimating the principal quality attributes of mango fruit, namely vitamin C content, soluble solids content (SSC), which reflects the concentration of soluble sugars such as sucrose, glucose, and fructose, and total acidity (TA), which measures the concentration of organic acids, including citric and malic acids. Thus, an important feature of the proposed methods is their capacity to preserve the information contained in spectral curves while delivering robust and reliable estimates of fruit quality attributes. It provides a more comprehensive characterization of fruit composition while maintaining robustness against data irregularities. This robustness enhances the reliability of the predictions, making the methods particularly suitable for complex spectroscopic data and helping to overcome the limitations of conventional regression approaches.
The remainder of this paper is organized as follows. Section 2 describes the materials and methods, including data acquisition and calibration procedures, and outlines the statistical models employed in the analysis. Section 3 presents the results along with their interpretation. Finally, Section 4 provides the main conclusions drawn from the study.

2. Materials and Methods

2.1. NIR Spectroscopic Data

The data were collected from a total of 186 mango samples across their maturation cycle, from unripe fruit to senescence. For each intact sample, near-infrared (NIR) spectral measurements were recorded across the 1000–2500 nanometer (nm) wavelength range. It is worth noting that the preprocessing step is an important part of NIR modeling. It permits us to reduce physical effects that are not related to the chemical information. In our study, the spectra were preprocessed using Standard Normal Variate (SNV) and detrending (DT), followed by a B-spline smoothing. SNV reduces the effects of light scattering, while DT corrects baseline trends. We recall that we have compared the proposed functional procedure with a non-functional approach based on Multiplicative Scatter Correction (MSC) and Savitzky–Golay (SG) smoothing. The obtained results show that the proposed functional procedure gives better predictive performance. Finally point out that it is well known that the MSC and SG procedure requires additional smoothing and tuning steps, which may increase the computational cost. Thus, our functional approach provides a simpler preprocessing procedure that allows us to keep the main features of the NIR spectra.
In parallel, reference measurements of vitamin C content, soluble solids content (SSC), and total acidity (TA) were obtained using standard laboratory procedures. As reported in [8], vitamin C and TA were measured by titration and are reported in milligrams per 100 g of fresh weight (mg 100 g−1) fresh mass (FM), whereas SSC was measured by refractometry and expressed in °Brix. Recall that 1 °Brix corresponds to 1 g of sucrose in 100 g of solution. Indeed, to determine vitamin C content, 5 g of mango pulp was first macerated and homogenized with 20 mL of metaphosphoric acid to prevent oxidation. Distilled water was then added to obtain a final volume of 50 mL. The vitamin C concentration was quantified by titration using 2,6-dichlorophenolindophenol (DCPIP) as a redox indicator, with the endpoint identified by a persistent color change from colorless to light red. The results were expressed as mg 100 g−1 fresh mass (FM) [18]. Next, for the determination of SSC and TA, juice was prepared from 20 g of mango pulp and diluted to a final volume of 100 mL with distilled water. After filtration, a portion of the juice was analyzed using a hand-held refractometer to measure SSC, which was reported in °Brix. Total acidity was determined by automatic titration with 0.1 N NaOH to an endpoint of pH 8.1, and the results were expressed as mg 100 g−1 fresh mass (FM) [19,20]. All data were collected at the Georg-August University of Göttingen, Germany. The dataset is publicly available and can be accessed through https://data.mendeley.com/datasets/b9d6s7hr33/1 (accessed on 27 April 2026).
The spectrometric data are displayed as curves in Figure 1, illustrating the intensity of near-infrared absorption as a function of wavelength. Typically, the x-axis represents the wavelength (nm) and the vertical axis represents the near-infrared (NIR) absorption, expressed in Absorbance Units (AU) as l o g 10 ( 1 / R ) , where R denotes the diffuse reflectance measured at each wavelength. Specifically, for each wavelength, the detector records the intensity of the light diffusely reflected by the sample and compares it with the intensity reflected from a calibrated reference standard. The diffuse reflectance is then computed as the ratio between the two intensities. We point out that this approach is the standard representation used in NIR spectroscopy, as it converts reflectance measurements into absorbance values.
Figure 1. Near-infrared spectrometric curves for mango fruits.
The dataset was obtained from four distinct mango cultivars (cv. Kweni, Cengkir, Palmer, and Kent), each of which exhibits characteristic compositional attributes that may influence their spectroscopic signatures. As described below, our main objective is to use this dataset to predict three principal quality attributes of mango fruit, namely vitamin C content, soluble solids content (SSC), and total acidity (TA). Combining spectrometric data analysis with statistical modeling constitutes a powerful and advanced approach in food quality assessment. Spectrometry provides detailed and precise information on the molecular composition, while statistical modeling complements this by uncovering the underlying relationships among the measured variables. Prior to conducting the functional data analysis, a multivariate factor analysis was performed to explore the possibility of reducing the dimensionality of the spectral data. This preliminary investigation aimed to assess whether vitamin C, SSC, and TA could be reliably predicted using a limited number of latent factors. However, the results indicated that the spectral data cannot be adequately represented through discretization on a reduced grid, suggesting that the complexity of mango chemical composition requires a more comprehensive analytical framework. These findings highlight the relevance of functional data analysis in this context. Functional modeling allows the full structure of the spectrometric curves to be exploited, improving the accuracy of multivariate techniques. The main contribution of this study lies in the adaptation of several robust functional regression models, namely, functional least squares relative error regression (FLSR), functional least absolute relative error regression (FLAR), and functional least absolute deviations regression (FLAD) for the prediction of vitamin C, SSC, and TA. Next, to demonstrate the advantages of these approaches, we evaluate their robustness in the presence of outliers and compare their performance with traditional methods such as partial least squares (PLS) and principal component regression (PCR). Outliers in the measured variables were detected using the MAD–median rule (Median Absolute Deviation test) [21], which provides a robust, nonparametric criterion based on the median and is particularly effective in the presence of skewed distributions and extreme observations. This approach is well suited to the present dataset, which exhibits substantial variability, as it limits the influence of atypical values without relying on distributional assumptions.
To model the relationship between the input spectral data I and the output chemical components O, we adopt a functional regression framework of the form
O = f ( I ) + error ,
where O represents the response variable (protein, SSC, or TA content) and I denotes the near-infrared (NIR) spectral curve. Estimating O given I = I is therefore equivalent to learning the unknown functional operator f ( · ) . To fully exploit the functional structure of the NIR spectra, each curve is represented using spline basis functions. Splines are particularly advantageous in spectroscopic settings due to their local support, numerical stability, and strong capability to capture smooth and flexible wavelength-dependent variations. Moreover, their piecewise polynomial structure allows accurate reconstruction of complex spectral shapes while avoiding overfitting, making them highly compatible with the smooth and highly correlated nature of NIR data.
Accordingly, each spectral curve is approximated as
I ( t ) ≈ ∑ k = 1 c k B k ( t ) , with t denoting the wavelength in nanometers   ( nm )
where B k ( · ) k denotes cubic B-spline basis functions and c k are the associated coefficients. As mentioned below, the choice of spline basis is motivated by its ability to provide a comprehensive representation of high-dimensional spectral signals, with smoothness control that is particularly well aligned with the characteristics of spectrometric data.

2.2. Models

In this context of big data analysis, several methodological approaches can be employed to address the prediction problem under study. In this section, we present three recently developed predictor models within the framework of functional statistics. For mathematical clarity, we assume that the sample ( I 1 , O 1 ) , … , ( I n , O n ) with n = 186 consists of independent observations, where the functional predictors are approximated using a suitable basis representation in the space F × R . The functional space F is equipped with a semi-metric d ( · , · ) , which measures the dissimilarity between curves. Throughout the remainder of the paper, R denotes the set of real numbers, E the expectation operator, and C a fixed element (curve) of the functional space F .

2.3. Functional Least Squares Relative Error Regression (FLSR)

The FLSR model is defined as the minimizer, with respect to t ∈ R , of
F L S R ( C ) = arg min y ∈ R Ψ ( y , C ) ,
where
Ψ ( y , C ) = E O i − y O i 2 ∣ I i = C .
It is worth noting that the FLSR model is a robust regression framework designed to improve prediction performance when data are affected by heteroscedasticity or scale-dependent variability. Unlike classical least squares methods that minimize squared residuals, FLSR focuses on minimizing relative errors, making it particularly suitable when the response variable exhibits large variations in magnitude. This relative formulation ensures that deviations are measured proportionally, allowing us to reduce the effect of the large-scale observations. As a result, FLSR provides a more balanced fit across different ranges of the data and enhances stability in the presence of outliers or non-uniform noise structures. Consequently, it is widely regarded as an effective alternative in settings involving complex or high-dimensional data, such as spectrometric and functional data analysis.
Given the sample ( I 1 , O 1 ) , … , ( I n , O n ) , we estimate Ψ ( y , C ) by
Ψ ^ ( y , C ) = ∑ i = 1 n K h − 1 d ( C , I i ) O i − y O i 2 ∑ i = 1 n K h − 1 d ( C , I i ) , ∀ y ∈ R ,
where K is a kernel function and h = h n > 0 is a bandwidth parameter satisfying h n → 0 as n → ∞ . A natural estimator of FLSR is then given by
F L S R ^ ( C ) = arg min y ∈ R Ψ ^ ( t , C ) .

2.4. Functional Least Absolute Relative Error Regression (FLAR)

FLAR is a robust modeling approach designed to minimize the sum of absolute relative deviations between observed and predicted values. Unlike classical least squares methods, which emphasize squared absolute errors, FLARE focuses on relative discrepancies, making it particularly suitable when the response variable exhibits heteroscedasticity or varies across different scales. This property allows the method to balance errors proportionally, ensuring that both small and large observations contribute fairly to the estimation process. Thus, FLARE regression demonstrates strong robustness to outliers and scale variations, which are common in real-world datasets, especially in high-dimensional and functional settings such as spectrometric data analysis. Furthermore, its formulation enhances interpretability in relative terms, providing meaningful comparisons of predictive accuracy across heterogeneous observations. Mathematically, the FLAR model is defined as the minimizer, with respect to y ∈ R , of
F L A R ( C ) = arg min y ∈ R Φ ( t , C ) ,
where
Φ ( y , C ) = E O i − y O i ∣ I i = C .
Under the same setting, the kernel estimator of Φ ( y , C ) is given by
Ψ ^ p ( C , y ) = ∑ i = 1 n W n i ( C ) O i − y O i , ∀ t ∈ R ,
where
W n i ( C ) = K ( h − 1 d ( C , I i ) ) ∑ j = 1 n K ( h − 1 d ( C , I j ) ) .

2.5. Functional Least Absolute Deviations Regression (FLAD)

FLAD regression is a robust alternative to classical least squares regression, designed to estimate model parameters by minimizing the sum of absolute residuals rather than squared errors. This formulation makes LAD particularly resistant to the influence of outliers, since large deviations are penalized linearly instead of quadratically. As a consequence, the method is more stable in the presence of heavy-tailed error distributions or contaminated data. Another important feature of LAD regression is its close connection to the conditional median of the response variable, providing a more robust measure of central tendency compared to the mean-based interpretation of least squares. Due to these properties, LAD regression is widely used in applications where data quality is uncertain or where robustness is a primary requirement. Formally, the LAD regression is defined by
F L A D ( C ) = arg min y ∈ R Γ ( y , C )
where
Γ ( y , C ) = E O i − y ∣ I i = C .
The corresponding estimator is given by
F L A D ^ ( C ) = arg min y ∈ R Γ ^ ( y , C )
with
Γ ^ ( y , C ) = ∑ i = 1 n K h − 1 d ( C , I i ) O i − y ∑ i = 1 n K h − 1 d ( C , I i ) , ∀ t ∈ R ,

2.6. Model Selection and Tuning Parameters

The predictive accuracy of the proposed models depends mainly on the choice of the semi-metric d ( · , · ) and the bandwidth parameter h. Given the functional nature of spectrometric curves, we adopt the L 2 semi-metric applied to spline-smoothed representations of the spectra, as in [22].
More precisely, let I ( t ) and J ( t ) be two spectral curves represented in a spline basis as
I ( t ) = ∑ k = 1 N c k B k ( t ) , J ( t ) = ∑ k = 1 N d k B k ( t ) ,
where { B k ( · ) } k = 1 N denotes the spline basis functions and c k , d k are the corresponding coefficients. The L 2 distance between the two curves is then given by
d L 2 ( I , J ) = ∫ T I ( t ) − J ( t ) 2 d t 1 / 2 .
In practice, this metric is computed on the spline approximation, which yields a stable and numerically efficient measure of similarity between high-dimensional spectral signals.
The optimal bandwidth h is selected using a leave-one-out cross-validation procedure by minimizing the mean squared error:
h o p t = arg min b ∈ H n M S E ,
where
M S E = 1 n ∑ i = 1 n O i − θ ^ ( I i ) 2 ,
and θ ^ denotes one of the predictors (FLSR, FLAR, or FLAD). The optimization is performed over the set H n , consisting of values b ( k ) that define the radius of a ball centered at I i , containing its k-nearest neighbors. The values of k are chosen from { 5 , 15 , 25 , … , 0.5 n } . A quadratic kernel function K ( · ) , defined on ( 0 , 1 ) , is used throughout the analysis.
Finally, we point out that the original dataset consists of 186 mango samples from four different varieties. These varieties may differ in peel thickness, flesh color, sugar content, and acidity levels. In the following Table 1, we report the sample size for each mango variety.
Table 1. Sample size for each mango variety.
The four mango varieties were deliberately regrouped into a single dataset to evaluate the robustness of our predictors. In fact our goal is to develop a global model capable of absorbing variations in peel thickness, color, and baseline chemical properties without requiring prior classification of the variety. Furthermore, we have to randomly divide the 186 observations into two independent subsets: 100 samples (approximately 54%) were used as the learning (training) set, while the remaining 86 samples (approximately 46%) were used as the testing set. Of course this random splitting is performed by ensuring that the four mango varieties were proportionally represented in both the learning and testing sets according to their respective sample sizes. Thus, this sampling procedure helps maintain the diversity and characteristics of the original dataset in both subsets. We note that the random sample splitting is appropriate in this context because it reduces the risk of introducing selection bias and prevents the learning and testing sets from differing systematically in terms of mango variety or spectral characteristics. It also provides a more representative assessment of the predictive performance of the proposed models on previously unseen samples. Consequently, the random and proportionally balanced allocation contributes to a fairer comparison among the competing methods and improves the reliability and robustness of the reported results. Recall that the learning sample is used to select the optimal tuning parameters, while the testing sample was reserved for an independent evaluation of the model performance through the mean square error defined by
E R R = 1 86 ∑ j ∈ testing sample ( O j − θ ^ ( l j ) ) 2 .
This separation ensures an unbiased assessment of predictive accuracy and provides a reliable validation of the proposed approach.

3. Results of Data Analysis

In this section, we present the prediction result of the three components, vitamin C content, soluble solids content (SSC), and total acidity (TA) SSC, using spectrometry as a covariates variable. In this real data example, we compare the functional predictor to the multivariate case. For the latter case, we use the routine code npreg and loess after the filter the spectrometric data using PCA to determine the more informative components.

3.1. Vitamin C Prediction Results

Accurate prediction of vitamin C content in mango fruit is of considerable importance, both from a nutritional and a quality assessment perspective. Vitamin C is a bioactive compound that contributes significantly to the antioxidant properties of mango and plays an essential role in human health, including immune support and protection against oxidative stress. Reliable estimation of its concentration provides valuable information for evaluating the nutritional value of the fruit. In addition, monitoring vitamin C levels is crucial for assessing fruit maturity, post-harvest quality, and overall consumer acceptability. Consequently, developing accurate predictive models for vitamin C not only enhances the characterization of mango nutritional composition but also supports improved quality control and decision-making in food production and supply chains. To do that, we tested several wavelength regions to identify the appropriate region containing prominent and informative spectral features (see Figure 2).
Figure 2. Near-infrared spectral curves used to predict vitamin C content.
This empirical selection was supported by the known chemical properties of the corresponding response variables. Indeed, it is well documented that vitamin C contains four hydroxyl (–OH) groups, as well as C–H, C=O, and C–O functional groups. Therefore, the 1300–1600 nm wavelength range represents a reasonable and chemically relevant region for its prediction. This region contains important spectral information associated with the O–H and C–H functional groups of ascorbic acid, including their overtone and combination bands, which contribute to the observed NIR absorption features. This choice is also consistent with previous NIR studies of ascorbic acid (see [23]).
We compare the functional method to the multivariate case and plot the result in the following Figure 3 and Figure 4.
Figure 3. Comparison of Vitamin C prediction results using the new functional models.
Figure 4. Comparison of vitamin C prediction results using the conventional real models.
Clearly, the functional models lead to a substantial improvement in predictive performance compared to the classical multivariate approaches. In particular, the prediction accuracy in the multivariate setting is 5.96 for PCR and 6.58 for PLSR, whereas the functional approaches achieve lower error levels of 3.72, 3.94, and 2.08 for FLSR, FLAR, and FLAD, respectively. These results clearly indicate that functional models outperform their non-functional counterparts in this application. Among the functional methods considered, the FLAD algorithm provides the most accurate and stable predictions, making it the most effective predictor in this study. This statement is justified by the fact that the FLAD is based on the least absolute deviation (LAD) loss, which minimizes absolute residuals. This loss function is less sensitive to unusually large prediction errors, making it more robust when the response variable contains extreme observations or is sampled from a symmetric error distribution. In the present application, vitamin C measurements exhibit large deviations. Consequently, the robustness of the LAD loss is advantageous, explaining the superior performance of FLAD for this response.

3.2. SSC Prediction Results

The prediction of soluble solids content (SSC) is particularly important in mango analysis, as it constitutes an important indicator of the fruit’s nutritional value, sweetness, flavor development, and overall quality. In mango, SSC is strongly associated with the concentration of natural sugars. It plays a central role in determining consumer acceptance and post-harvest quality assessment. Reliable estimation of SSC is therefore essential for evaluating fruit maturity, optimizing harvest time, and ensuring consistent quality in both fresh consumption and industrial processing. From a nutritional perspective, SSC provides valuable information about the energy content and biochemical composition of mango fruit, making it an important attribute in food quality control. In addition, accurate SSC prediction supports better classification of fruit batches and contributes to improving storage, processing, and distribution strategies. By integrating spectrometry with advanced statistical modeling, it becomes possible to monitor mango composition in a non-destructive and efficient manner, detect quality variations, and enhance decision-making in agricultural and food systems. The corresponding spectrometric curves used in this analysis are illustrated in the following figure (see Figure 5).
Figure 5. Near-infrared spectral curves used to predict SSC.
For Soluble Solids Content (SSC), the 1000–1300 nm region is considered an appropriate wavelength range because it contains useful information related to both sugars and water in fruit. In particular, it is well known that the region 1195–1210 nm is associated with the second overtone of C–H stretching vibrations, which are related to carbohydrate structures. In addition, the 1150–1200 nm region contains information related to the second overtone of O–H stretching vibrations in water. Thus, the selected region provides useful information for predicting SSC in mango fruit.
Furthermore, the obtained prediction results are given in the following Figure 6 and Figure 7.
Figure 6. Comparison of SSC prediction results using the new functional models.
Figure 7. Comparison of SSC prediction results using the conventional real models.
Once again, the functional approach demonstrates superior predictive accuracy compared to the classical vector-based framework. This observation is clearly supported by the mean squared error (MSE) values defined in (1), where PCR and PLSR yield relatively higher errors of 1.07 and 1.23, respectively, whereas the functional models achieve substantially lower errors of 0.45, 0.21, and 0.63 for FLSR, FLAR, and FLAD, respectively. These results confirm that functional methodologies provide a more effective representation of the underlying data structure, leading to improved estimation performance in multivariate settings. In particular, the FLAR model appears to offer the most accurate predictions among the considered functional approaches, highlighting its suitability for this type of spectrometric data analysis. Finally, it is worth noting that most of the models show a slight tendency to underestimate the response variable. This may be due to the smoothing effect of the proposed functional methods and the use of a relative error loss function, both of which tend to produce more conservative predictions.

3.3. TA Prediction Results

Total acidity is a cornerstone of mango quality, serving as the primary driver of the fruit’s characteristic and flavor balance. It works in tandem with sugar content to determine the sugar acid ratio, which is the ultimate benchmark for consumer palatability and ripeness. Beyond taste, acidity levels influence the fruit’s pH, affecting its resistance to microbial decay and its suitability for industrial processing. Consequently, the ability to accurately predict acidity is vital for the mango industry; it allows growers and distributors to pinpoint the optimal harvest window, categorize fruit by taste profile, and manage the supply chain effectively. By predicting these levels non-destructively, producers can ensure consistent quality and a longer shelf life, ultimately reducing waste and meeting high consumer expectations. The appropriate segments of spectrometry curves are plotted in Figure 8.
Figure 8. Near-infrared spectral curves used to predict TA.
The empirical analysis shows that the 1750–2000 nm region provides highly relevant spectral information for predicting acidity levels in mango fruit. This interval contains distinct absorption features associated with O–H, C–H, and C=O functional groups, which comprise the molecular structure of the fruit’s primary organic acids (such as citric and malic acid).
We compare four different predictive models based on standard regression and local regression, in a manner similar to the previous prediction problems, along with their PCA-based counterparts and functional formulations. The obtained results are summarized and illustrated in Figure 9 and Figure 10, which provide a clear visual comparison of the performance of each approach.
Figure 9. Comparison of TA prediction results using the new functional models.
Figure 10. Comparison of TA prediction results using the conventional real models.
It is evident that the vectorial models are less effective in predicting total acidity (TA) compared to the functional predictors, which achieve substantially higher predictive accuracy. Specifically, the prediction error (ERR) values are 25.78 for PCR and 40.18 for PLSR, whereas the functional approaches yield considerably lower errors of 12.82, 11.74, and 13.63 for FLSR, FLAR, and FLAD, respectively. In particular, the FLAR model provides the most accurate prediction of the TA component, with a notably reduced error, highlighting a significant improvement in performance over both classical and alternative functional methods. Recall that the FLAR is based on an absolute relative error criterion. The latter emphasizes proportional accuracy and is less dependent on the absolute scale of the response. This property is particularly useful for SSC and TA, where the magnitude of the prediction error relative to the measured chemical concentration is more relevant.

3.4. Robustness Assessment of the Functional Predictors

As mentioned in the Introduction section, one of the main features of the proposed predictors is their robustness and scale invariance. To highlight these properties, we investigate the robustness of the three models through an outliers analysis framework.
Specifically, we employ the Median Absolute Deviation (MAD) test to detect outliers in each response variable. This nonparametric procedure is particularly suitable for datasets exhibiting non-normality and extreme observations. By varying the proportion of observed outliers, we analyze the sensitivity of the proposed predictors under different contamination levels. The number of detected outliers in each response variable is reported in Table 2. It was obtained using the mad routine code in R.
Table 2. Number of detected outliers in each response variable using the MAD test.
Now, to assess robustness, we evaluate the variability of several performance metrics, including Root Mean Squared Error (RMSE), Mean Absolute Error (MAE) and Residual Predictive Deviation (RPD), under different contamination levels controlled by removing some proportion of the outliers. These metrics are defined as follows:
RMSE = 1 86 ∑ j ∈ testing sample ( O j − θ ^ ( l j ) ) 2 ,
MAE = 1 86 ∑ j ∈ testing sample | O j − θ ^ ( l j ) | ,
RPD = SD ( O ) RMSE .
We note that the same kernel and functional metric used in the previous empirical analysis are retained here. However, to provide a more appropriate assessment of the robustness of the three models, we replace the previous MSE-based cross-validation criterion with a model-specific cross-validation procedure. Specifically, the bandwidth is selected according to the loss function associated with each model. For the FLSR model, the optimal bandwidth h is selected using the following leave-one-out cross-validation criterion:
h F L S R opt = arg min b ∈ H n 1 n ∑ i = 1 n O i − F L S R ^ ( I i ) O i 2 .
For the FLAR model, the optimal bandwidth is selected by minimizing the corresponding absolute relative error:
h F L A R opt = arg min b ∈ H n 1 n ∑ i = 1 n O i − F L A R ^ ( I i ) O i .
Finally, for the FLAD model, the optimal bandwidth is determined by minimizing the absolute deviation loss:
h F L A D opt = arg min b ∈ H n 1 n ∑ i = 1 n O i − F L A D ^ ( I i ) .
The corresponding results for each contamination level and each model are summarized in Table 3, allowing a direct comparison of predictive stability and robustness in the presence of outliers.
Table 3. Prediction performance of the functional regression models under different levels of outlier removal.
The results reported in Table 3 indicate a generally low variability of the prediction errors across different levels of outlier removal, which highlights the robustness of the proposed approaches. Indeed, for all response variables (Vitamin C, SSC, and TA) and for all predictors (FLAD, FLAR, and FLSR), the performance measures (RMSE, MAE, and RPD) remain remarkably stable when the percentage of removed outliers varies from 100% to 0%. In particular, only slight changes are observed in RMSE and MAE values, even when no outliers are removed, suggesting that the models are not strongly affected by data contamination. It should be noted that, although the proposed methods involve additional steps, such as smoothing and bandwidth selection, they remain computationally efficient for the dataset considered. The average execution times of the proposed functional methods are reasonable and remain within a modest range compared with the classical chemometric models. The average execution times of all considered models are reported in Table 4.
Table 4. Average execution time of the considered models on a standard desktop computer.

4. Conclusions

In this contribution, we investigate an alternative predictive framework based on three robust regression models. The corresponding estimators are constructed using a kernel-based approach within each model. The functional nature of the spectral data is represented through principal component analysis and Karhunen–Loève decomposition, and further approximated using smooth basis functions. We address three prediction problems using robust functional algorithms. The first concerns the prediction of vitamin C content, where the results confirm the usefulness of near-infrared spectrometry for this task. In particular, wavelengths in the range 1300–1600 nm are found to be most informative for vitamin C estimation. Among the considered methods, the FLAD regression provides the best predictive performance compared to the other approaches. For soluble solids content (SSC), the most relevant spectral information is observed in the range 1000–1300 nm, and in this case the FLAR regression yields the most accurate results. Regarding total acidity (TA), the most informative wavelengths are concentrated in the range 1750–2000 nm, where again the FLAR regression demonstrates superior performance. We have proved that the functional methods outperform PCR and PLSR. This statement is justified by the fact that the functional approach preserves the smoothness and main spectral features of the curves arising from the strong correlation between neighboring wavelengths. PCR and PLSR, in contrast, represent spectra using a finite number of linear components obtained according to specific optimization criteria. Moreover, our approach uses a nonparametric functional regression model, which does not impose a predetermined linear relationship between the spectral curves and the response variable and can explore complex and nonlinear associations. On the other hand, we specify that the wavelength regions were selected through empirical analysis of the NIR spectra and were further supported by the known chemical properties of the corresponding response variables. For instance, the 1300–1600 nm region was selected for vitamin C because it contains relevant O–H and C–H absorption features associated with ascorbic acid. For SSC, the 1000–1300 nm region provides useful information related to sugars and water, particularly through C–H and O–H absorption bands. Concerning TA, the 1750–2000 nm region contains relevant absorption features associated with O–H, C–H, and C=O groups present in organic acids.
Overall, the main contribution of this work is emphasized by its ability to analyze mango samples directly from spectrometric measurements without requiring extensive preprocessing (such as Savitzky–Golay (SG) smoothing or Multiplicative Scatter Correction) by preserving the relationship between chemical composition and spectral information. In this sense, the proposed methodology integrates advanced spectroscopic techniques with modern statistical learning tools, offering a low-cost, flexible, and robust framework for mango quality assessment. It is also worth noting that the use of statistical learning and big data methodologies in food and dairy science is a rapidly growing research area, as highlighted in recent studies [24]. Readers interested in the development of data-driven approaches for food quality and related applications may refer to the comprehensive review presented in [25]. However, all applications of nonparametric functional regression in real-time prediction involve several challenges. The choice of an appropriate metric for measuring the distance between spectral curves can affect the identification of neighboring observations and, consequently, prediction accuracy. Similarly, the selection of the smoothing parameter (bandwidth) is critical because it controls the bias–variance trade-off and can substantially influence the predictions. Although cross-validation was used in this study, its computational cost may be an issue for real-time applications. In addition, rapid spectral preprocessing and efficient model prediction are required for practical implementation. Therefore, our results demonstrate the potential of the proposed methods for real-time mango quality assessment, while further work is needed to address these computational and methodological challenges. In the same direction, this work opens several promising directions for future research. Among the most relevant extensions, we mention the k-nearest neighbors method, semi-parametric models, spatial functional frameworks, and surrogate data approaches. Furthermore, comparing our approach with more complex machine learning models such as SVR, Random Forests, Gaussian Process Regression, and XGBoost represents an important and promising direction for future research in mango cultivation in Saudi Arabia. These advanced methods could potentially enhance the precision of mango quality assessment and support more efficient decision-making in agricultural production systems. However, they typically require larger datasets and careful hyperparameter tuning.

Author Contributions

The authors contributed approximately equally to this work. Conceptualization, methodology, Validation M.B.A.; Formal analysis, Writing—original draft preparation F.A.A.; Writing—review and editing, supervision A.L. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by Princess Nourah bint Abdulrahman University Researchers Supporting Project number (PNURSP2026R515), Princess Nourah bint Abdulrahman University, Riyadh, Saudi Arabia; and the Deanship of Scientific Research and Graduate Studies at King Khalid University through the Research Groups Program under grant number R.G.P.2/17/47.

Data Availability Statement

The data used in this study are available through the link https://data.mendeley.com/datasets/b9d6s7hr33/1 (accessed on 27 April 2026).

Acknowledgments

The authors would like to thank the Editor, the Associate-Editor and the three anonymous reviewers for their valuable comments and suggestions, which substantially improved the quality of an earlier version of this paper. The authors thank and extend their appreciation to the funders of this work: This research is funded was by Princess Nourah bint Abdulrahman University Researchers Supporting Project number (PNURSP2026R515), Princess Nourah bint Abdulrahman University, Riyadh, Saudi Arabia; and the Deanship of Scientific Research and Graduate Studies at King Khalid University through the Research Groups Program under grant number R.G.P.2/17/47.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Almarri, N.B.; Mostafa, S.M.; Alsofuani, N.M.; Osman, S.; Alomran, S.M.; Ibrahim, M.A.; Alrashidi, I.; Al-Haidar, O.A.; Ahmad, S. Whole-genome sequencing reveals genomic diversity and population structure of mango germplasm from the Jazan region of Saudi Arabia. Front. Plant Sci. 2026, 17, 1808140. [Google Scholar] [CrossRef] [Scilit]
  2. Swaroop, A.; Bagchi, M.; Moriyama, H.; Bagchi, D. Health benefits of mango (Mangifera indica L.) Mangiferin. Jpn. J. Med. 2018, 1, 149–154. [Google Scholar] [CrossRef] [Scilit]
  3. Kumar, M.; Saurabh, V.; Tomar, M.; Hasan, M.; Changan, S.; Sasi, M.; Maheshwari, C.; Prajapati, U.; Singh, S.; Prajapat, R.K.; et al. Mango (Mangifera indica L.) Leaves: Nutritional Composition, Phytochemical Profile, and Health-Promoting Bioactivities. Antioxidants 2021, 10, 299. [Google Scholar] [CrossRef] [Scilit]
  4. Liu, Y.; Ying, Y. Use of FT-NIR spectrometry in non-invasive measurements of internal quality of ‘Fuji’ apples. Postharvest Biol. Technol. 2005, 37, 65–71. [Google Scholar] [CrossRef] [Scilit]
  5. Lin, H.; Ying, Y. Theory and application of near infrared spectroscopy in assessment of fruit quality: A review. Sens. Instrum. Food Qual. Saf. 2009, 3, 130–141. [Google Scholar] [CrossRef] [Scilit]
  6. Magwaza, L.S.; Opara, U.L.; Nieuwoudt, H.; Cronje, P.J.R.; Saeys, W.; Nicolaï, B. NIR spectroscopy applications for internal and external quality analysis of citrus fruit a review. Food Bioprocess Technol. 2012, 5, 425–444. [Google Scholar] [CrossRef] [Scilit]
  7. Lamptey, F.P.; Teye, E.; Abano, E.E.; Amuah, C.L.Y. Application of handheld NIR spectrometer for simultaneous identification and quantification of quality parameters in intact mango fruits. Smart Agric. Technol. 2023, 6, 100357. [Google Scholar] [CrossRef] [Scilit]
  8. Rahman, K.S.; Rakib, M.R.I.; Rahman, A.; Khaled, A.A.; Salehin, M.M.; Amin, A.; Rahman, A. Rapid assessment of fruits and vegetables quality using spectroscopy and imaging techniques: Recent advances and perspectives. Food Eng. Rev. 2025, 17, 777–808. [Google Scholar] [CrossRef] [Scilit]
  9. Wang, C.; Li, X.; Zhang, Z.; Luo, X.; Cai, J.; Wang, A. Nondestructive quality detection of characteristic fruits based on Vis/NIR spectroscopy: Principles, systems, and applications. Agriculture 2025, 15, 2167. [Google Scholar] [CrossRef] [Scilit]
  10. Zhou, J.; Zhao, D.; Chen, Y.; Kang, G.; Cheng, C. Fruit quality, sugar-acid fractions, volatile aroma components, phenolic compounds of early fruit stage ‘Harlikar’ trees onto different dwarfing rootstocks. Sci. Hortic. 2026, 357, 114639. [Google Scholar] [CrossRef] [Scilit]
  11. Evangelista, C.; Contò, M.; Basiricò, L.; Bernabucci, U.; Failla, S. Near-Infrared Spectroscopy for Assessing the Chemical Composition and SSCty Acid Profile of the Total Mixed Rations of Dairy Buffaloes. Appl. Sci. 2025, 15, 3211. [Google Scholar] [CrossRef] [Scilit]
  12. Aguilera, A.M.; Escabias, M.; Valderrama, M.J.; Aguilera-Morillo, M.C. Functional analysis of chemometric data. Open J. Stat. 2013, 3, 334–343. [Google Scholar]
  13. Ferraty, F.; Vieu, P. The functional nonparametric model and application to spectrometric data. Comput. Stat. 2002, 17, 545–564. [Google Scholar] [CrossRef] [Scilit]
  14. Almanjahie, I.M.; Ahmad, I.; Chikr Elmezouar, Z.; Laksaci, A. Modern statistical analysis of forage quality assessment with NIR spectroscopy. Appl. Ecol. Environ. Res. 2019, 17, 14333. [Google Scholar] [CrossRef] [Scilit]
  15. Almanjahie, I.M.; Fetitah, O.; Attouch, M.K.; Benchikh, T. Functional nonparametric predictions in food industry using near-infrared spectroscopy measurement. Comput. Mater. Contin. 2023, 74, 6307–6319. [Google Scholar] [CrossRef] [Scilit]
  16. Almulhim, F.A.; Alamari, M.B.; Laksaci, A.; Kaid, Z. Modal regression estimation by local linear approach in high-dimensional data case. Axioms 2025, 14, 537. [Google Scholar] [CrossRef] [Scilit]
  17. Acar-Denizli, N.; Delicado, P. Functional data analysis for wearable sensor data: A systematic review. AStA Adv. Stat. Anal. 2025, 19, 591–631. [Google Scholar] [CrossRef] [Scilit]
  18. Marques, E.J.N.; de Freitas, S.T.; Pimentel, M.F.; Pasquini, C. Rapid and non-destructive determination of quality parameters in the ‘Tommy Atkins’ mango using a novel handheld near infrared spectrometer. Food Chem. 2016, 197, 1207–1214. [Google Scholar] [CrossRef] [Scilit]
  19. Cortés, V.; Ortiz, C.; Aleixos, N.; Blasco, J.; Cubero, S.; Talens, P. A new internal quality index for mango and its prediction by external visible and near-infrared reflection spectroscopy. Postharvest Biol. Technol. 2016, 118, 148–158. [Google Scholar] [CrossRef] [Scilit]
  20. Jha, S.N.; Narsaiah, K.; Jaiswal, P.; Bhardwaj, R.; Gupta, M.; Kumar, R.; Sharma, R. Nondestructive prediction of maturity of mango using near infrared spectroscopy. J. Food Eng. 2014, 124, 152–157. [Google Scholar] [CrossRef] [Scilit]
  21. Wilcox, R.R.; Keselman, H.J. Modern robust data analysis methods: Measures of central tendency. Psychol. Methods 2003, 8, 254. [Google Scholar] [CrossRef] [Scilit]
  22. Ferraty, F.; Vieu, P. Nonparametric Functional Data Analysis: Theory and Practice; Springer Series in Statistics; Springer: New York, NY, USA, 2006. [Google Scholar]
  23. Tjandra Nugraha, D.; Zinia Zaukuu, J.L.; Aguinaga Bosquez, J.P.; Bodor, Z.; Vitalis, F.; Kovacs, Z. Near-infrared spectroscopy and aquaphotomics for monitoring mung bean (Vigna radiata) Sprout Growth Valid. Ascorbic Acid Content. Sensors 2021, 21, 611. [Google Scholar] [CrossRef] [Scilit]
  24. da Silva Pereira, E.; Cruz-Tirado, J.P.; Crippa, B.L.; Morasi, R.M.; de Almeida, J.M.; Barbin, D.F.; Junior, S.B.; Silva, N.C.C. Portable near infrared (NIR) spectrometer coupled with machine learning to classify milk with subclinical mastitis. Food Control 2024, 163, 110527. [Google Scholar] [CrossRef] [Scilit]
  25. Liang, Q.; Xia, Y.; Che, J.; Liu, Y.; Zhang, H.; Guo, J.; Xu, Q.; Xue, H. Detection of water adulteration levels in milk using near-infrared spectroscopy combined with chemometrics. J. Dairy Sci. 2025, 108, 6852–6866. [Google Scholar] [CrossRef] [Scilit]
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.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.