Ripeness Prediction in Table Grape Cultivars by Using a Portable NIR Device

: In the past years, near infrared (NIR) spectroscopy has been applied to the agricultural industry as a non-destructive tool to predict quality parameters, e.g., ripeness of fruit, dry matter content, and acidity. In two years, 2019 and 2020, berries of four table grape cultivars (Cotton Candy™, Summer Royal, Allison™, and Autumncrisp ® ) were collected during the season to obtain spectral measurements and quality data for developing predictive models based on NIR spectroscopy to be practically used in the vineyard. A SCiO™ sensor was used in 2019 for predicting the ripening parameters of Cotton Candy™; in particular, total soluble solids (TSS) (R 2 = 0.95; RMSE = 0.60, RPD = 13.13), titratable acidity (R 2 = 0.97; RMSE = 0.40, RPD = 7.31), and pH (R 2 = 0.96; RMSE = 0.07, RPD = 26.06). With these promising results, in the year 2020, the above-mentioned table grape cultivars were all tested for TSS prediction with successful outcomes: Cotton Candy™ (R 2 = 0.97; RMSE = 0.68, RPD = 7.48), Summer Royal (R 2 = 0.96; RMSE = 0.83, RPD = 7.13), Allison™ (R 2 = 0.97; RMSE = 0.72, RPD = 8.70) and Autumncrisp ® (R 2 = 0.96; RMSE = 0.60, RPD = 9.73). In conclusion, a rapid and economic sensor such as the SCiO™ device can enable a practical application in the vineyard to assess ripening (quality) parameters of table grapes. Thus, this device or similar ones can be also used for a fast sorting and screening of quality throughout the supply chain, from vineyard to cold storage.


Introduction
In the horticultural industry, in particular for fruits, the rapid and non-destructive determination of ripening is a very important aspect. A powerful tool in this field is represented by reflectance spectroscopy, a non-destructive technique which is based on measuring the electromagnetic radiations reflected at different wavelengths by target surfaces, especially in the visible (400-700 nm), near infrared (700-1300 nm), and thermal infrared regions (7500-15,000 nm) [1]. The chemical characteristics of the sample influence directly the absorption or reflectance of the radiations so that it is possible to monitor specific elements by analyzing the spectrum response.
In particular, near infrared (NIR) spectroscopy studies the spectral properties of an object exposed to an electromagnetic radiation in the range between 780 nm and 2500 nm [2]. In the regions of NIR suitable for food analysis, short-wave NIR (at 700-1100 nm) allows a deeper penetration through the sample during measurement if compared with the longwave NIR (at 1100-2500 nm) [3]; moreover, short-wave NIR, contrary to long-wave NIR, table grape with different ripening grades in the supply chain would be better managed by workers in this case.
Quality data useful to be assessed by producers, technicians, traders, and consumers include sweetness (total soluble solids (TSS)), titratable acidity (TA), firmness, and pH. Nowadays, conventional techniques for determining such internal quality parameters of table grape and other fruits involve destructive and time-consuming means. For these analyses, a representative sample is used to predict the quality of cluster/vine/vineyard and this usually brings variable values depending on the sampling adopted. Therefore, a rapid non-destructive prediction of TSS (plus pH, TA) for table grape is of great value for the determination of the best harvesting time with positive effects on the eating quality tasted by consumers. Moreover, the possibility to check the ripening values in precise positions of the orchard/vineyard would support the optimal harvesting time for the fruit to carry on an accurate harvest. This would also meet the demand of consumers for high-quality fruits perfectly ripened in the different areas of the world. NIR spectroscopy has also been applied to detect nitrate levels in some fruits such as pineapple [33], soluble solids content and acidity in kiwifruit [8], pear internal quality indices [34], maturation levels in Fuji apple [15], and TSS and dry matter of table grape and peach cultivars [35]. Portable NIR spectrometers have been used to determine fruit quality parameters such as TSS, TA, sugar content, firmness, or other quality parameters in pear, apple, mango, orange, or nectarine [36][37][38][39][40] but less is known about the application for table grape cultivars [35].
In this research, the SCiO™ sensor produced by Consumer Physics Inc. was tested on the table grape for evaluating ripening parameters in a two-year trial. Berries of seedless table grape cultivars were collected during the growing season and the NIR spectral measurements and quality variables were analyzed for developing predictive models.
Once data were collected, the challenge regards the choice of the data analysis method. Partial Least Square Regression (PLSR) and Multiple Linear Regression (MLR) are the most commonly used methods for prediction of a target variable using a multivariate set of predictors variables [41,42]. These two methods are highly affected by the presence of environmental noises during the acquisition phase (i.e., temperature and light) and instrument degradation (mechanical and electrical components aging) which introduce nonlinearities in the spectra. These disturbances can be managed by means of pre-processing operation based on statistical methods such as logarithmic transformation, first and second derivatives, and the SNV method [5,43].
On the basis of these considerations, this work focused on the application of an NIR spectroscopy for assessing table grape quality parameters for four cultivars for the best time of harvest by means of the SCiO TM portable device. This is the first step to successively monitor the ripening of the grape in the different blocks of the vineyard by using a specific application.

Table Grape Cultivars
In the present trial, four table grape cultivars were used. The table grapes were collected in four different vineyards located in the Puglia region, Southern Italy, the most important region for table grape cultivation in the country. The region has an extension of 19.330 km 2 , flat for 50% of the territory. More than 60% of the region is used as agricultural area, mostly for the production of olive oil, cherries, vegetables, and wine and table grapes. Puglia has short surface water courses and a very extensive underground water system due to the presence of limestone and dolomitic rocks. The agricultural economy and culture of the area is supported by the Mediterranean climate characterized by warm summers and moderate winters, with low rainfall spread over all seasons [44]. The characteristics of the tested cultivars are described below.
Allison™, also known as Sheegene 20, belongs to the SNFL GROUP. It is a seedless cultivar obtained in 2000 from the cross Princess × Red Globe. It is characterized by the red color of the skin, with a round to slightly ellipsoidal shape and with about 18% TSS at ripening. In Italy it is generally harvested between September and November, around 2-3 weeks after Crimson Seedless and with a diameter >22 mm. Allison™ was collected from a vineyard in the countryside of Noicattaro (Ba).
Autumncrisp ® or Sugra35 is a cultivar obtained by SunWorld. This is also a late seedless cultivar, harvested in Italy between September and October. It was obtained by the cross Italia × Dzhidzhigi Kara (from Turkmenistan), and the program started in the 1980s, until the first commercialization in 2012. The berries have a green-yellowish skin color with a large size and a Moscato aroma and with about 15-16% TSS at ripening. Autumncrisp ® was collected from a vineyard in the countryside of Mola di Bari (Ba).
Cotton Candy™ or IFG7, is a seedless IFG cultivar characterized by a unique flavor reminiscent of cotton candy, which makes it very popular among children. It was obtained in 2003 through the cross A2674 × Princess. It is generally harvested between the end of July and the beginning of September. The berries have a green-yellowish skin color, a medium-large size with about 18% TSS at ripening. Cotton Candy™ was collected from a vineyard in the countryside of Noicattaro (Ba).
Summer Royal (USDA selection B74-99) is a seedless black grape cultivar obtained by crossing a seeded cultivar A69-190 and a seedless cultivar C20-149 in 1985, then it was released in 1999. The berries are round, black, of medium-large size, and this cultivar is harvested between July and August in Italy, with around 18% TSS. Summer Royal was collected from a vineyard in the countryside of Noicattaro (Ba).

SCiO™ Sensors
SCiO™ sensors (Consumer Physics Inc., Tel-Aviv, Israel) were used to acquire the spectral data of table grape berries in the wavelength range of 740-1070 nm with a wavelength resolution <10 cm −1 and a sampling interval of 1 nm. Then, the SCiO™ Lab online application produced by the same company of the sensor device (Consumer Physics Inc., Tel-Aviv, Israel) was used on a smartphone for collecting, storing, and analyzing the data. On detached berries, collected at different fruit growth and ripening stages in both experimental years (2019 and 2020), spectral readings were acquired. Details on sampling are reported in the following paragraphs. The radiation emitted by the instrument hit the berry and the reflected light was detected by the SCiO™ sensor. The acquired response spectrum (740-1070 nm) was visible on the smartphone (Bluetooth acquisition) and sent to the SCiO™ cloud database for successive analyses. The calibration operation was performed daily by means of the reference tool (a white tile present inside the sensor cover) provided by the producer [5].

Berry Sampling and Analyses
The trial was performed over two years: in the first year (2019) the analyses were carried out only on Cotton Candy™ in order to conduct a pre-investigation for the affordability of the data. A total of 300 berries were collected and analyzed from 12 July to 2 September 2019; 200 berries were used for model calibration and 100 berries for the external model validation. In the second year (2020), the trial was carried out on the four cultivars and 235 berries for each cultivar were collected from June until September (during the whole season); for each cultivar, 175 berries were used for model calibration and the remaining 60 berries for the external model validation. In both years the berries were collected at various development and maturity stages at 7-10 days interval from the stage of berry growth until ripened for harvesting. Berries to be picked up were chosen to be representative of the conditions observed (color, size, TSS) in the vineyard at each sampling time. Spectral data of each single berry were acquired under laboratory conditions by means of the SCiO™ sensor (v1.2), followed by destructive analysis for the determination of berry quality parameters (TSS, TA, and pH). For each sample acquisition, three scans per berry were performed at different locations around the equator, approximately 120 • apart, at a distance <0.5 cm from the device. Regression models were developed through the combination of both quality parameters and spectral data in order to verify the measured quality attributes with an instant estimation. The predicted (SCiO™ sensor) and measured (chemical analysis) quality parameters were compared to assess the model prediction performances.
The TSS (%) of the juice collected from each berry was measured by means of a hand-held, digital refractometer HI96814 (Hanna Instruments, Woonsocket, RI, USA). For titratable acidity (TA) expressed as grams of tartaric acid per liter of juice and pH, 1 mL of juice extracted from each berry was diluted with 49 mL of distilled water, and then the mixture was titrated against 0.1 N standard NaOH to reach an end point of pH 8.1 with an automatic titrator (PH-Burette 24, Crison Instruments, Barcelona, Spain).

Data Analysis
The analysis of the spectral data was performed by means of the SCiO™ Lab online interface. To develop a model for the quality attribute of interest, the data for the preprocessing techniques are first identified and then through the option "Create Model", model generation is initiated [5]. The software includes the selection of some pre-processing techniques such as mean centering, first or second order derivation, logarithmic transformation, and standard normal variate (SNV). In addition, the software allows creating prediction models through different multivariate statistics and machine learning methods such as partial least squares regression (PLSR), clustering analysis and Random Forest. In a previous study, model performance of the SCiO™ Lab online interface was compared with that obtained with the widely used software for chemometric analysis and a similar predictive performance was obtained [5].
Common pre-processing operations for spectral data are smoothing, denoising, detrending, logarithmic transformation, differentiation, and scatter correction methods such as first-and second-order derivatives, multiplicative signal correction (MSC) and standard normal variate (SNV) transformation. Logarithmic transformation is widely used in biometry when data are strongly skewed and follow a log-normal distribution. In this case, the log transformation reduces the skewness effectively, while when the dataset is far from a log-normal distribution, the transformation can even introduce more skewness [6].
Differentiation is widely applied in spectroscopic studies to enhance spectral resolution and to eliminate background effects [45]. The standard normal variate (SNV) method aims to transform each spectrum data obtaining a new variable with zero mean and standard deviation equal to one [43]. Each spectrum is first centered in zero and then divided by its standard deviation so absorbance levels can be easily analyzed and compared. This is extremely useful in presence of changes in optical path length and light scattering since the standard deviation of the spectra represent these changes [46]. On the other hand, the multiplicative effects are not uniform over the absorbance response, so SNV can introduce false artifacts [46]. In general, the first derivative allows removing additive baselines; meanwhile the second derivative eliminates a multiplicative one. The SNV transformation also removes the additive and multiplicative baselines with no shape change in the spectra, but it results more sensitive to the chemical composition [46].
In this study, different combinations of pre-processing techniques were compared on data collected during the first year (2019) and the best combinations were selected for the model calibration considering the best performance.
The model was then developed on the cloud database through the partial least squares regression (PLSR) algorithm. PLSR is a multivariate regression method combining features from Principal Components Analysis) (PCA) and multiple linear regression [42].
The method aims to find the relationship, by means of a linear multivariate model, between one (PLS1) or multiple dependent variables (PLS2), named response variables, and a set of independent variables, named predictors. Then, the prediction is based on a set of orthogonal factors which are a linear combination of the original variables, named latent variables, with the best predictive potential. For this reason, this method is also called projection to latent structures, and it was first applied in social sciences, then in chemometrics and sensory evaluation [47]. The definition of the optimal number of latent variables is critical for the method efficiency. The adaptation goodness of the model on the response data increases with a high number of elements as long as there is a risk of overfitting.
The SCiO™ software can select the number of latent variables automatically for each model, so it is possible to compare the number of the chosen components in the different models.
Once the model is calibrated using a training/calibration dataset, it requires a validation phase in which another dataset is tested in order to evaluate the predictive accuracy [48]. The performance of the calibration models was evaluated by means of Root Mean Square Error (RMSE), coefficient of determination (R 2 ), and Residual Prediction Deviation (RPD) as well as the number of latent variables.
Specifically, the Root Mean Square Error (RMSE), also known as the Root Mean Square Deviation, is referred to as the distances, in vertical direction, between the original dataset and the prediction model; the lower the value, the better the performance of the model. The R 2 indicator or coefficient of determination is used to measure how the model fits the data assuming a zero value in case the model is completely far from the data distribution and a value equal to one in case the model describes the data perfectly. An R 2 value between 0.66 and 0.81 provides approximate quantitative predictions, meanwhile a value above 0.82 indicates good predictions [49,50].
The RPD refers the prediction accuracy and is expressed by the standard deviation of the dataset over the RMSE [51].
The higher the RPD values the greater the power of the model to predict unknown samples accurately [5]. Usually, an RPD value below 1.5 indicates that the model cannot be used to describe the dataset, while values between 1.5 and 2.0 indicate that the model is able to discriminate low from high values of the response variable adequately; values between 2 and 2.5 indicate that approximate quantitative predictions are possible. For values between 2.5 and 3.0 and above 3.0, the prediction is classified as good and excellent, respectively [5,[52][53][54].
The 2019 study was focused on the comparison between the model performance obtained with the raw spectra and the transformed spectra after the application of a combination of the above-mentioned pre-processing techniques for the estimation of TSS, pH and titratable acidity in Cotton Candy™. This analysis was performed five times on four sample groups (3 for the calibration and one for the prediction) The four combinations of the pre-processing techniques considered the use of the first or second derivative with or without the logarithmic transformation:
From the results of this analysis, the two best combinations for each parameter were used to build the prediction model. Specifically, the first three sample groups were used to build the model and the fourth to validate it.
The 2020 experiment was focused on the study of the evolution of the TSS (%) in the four cultivars. For this analysis, TSS were monitored from June to September, providing ripening curves of each cultivar and the relative datasets for the prediction models.

Results and Discussion
The SCiO™ Lab online interface allows to visualize raw and pre-processed spectral data, to duplicate and merge datasets, and data download and upload. However, the interface presents limited capability for manipulation and statistical analysis of spectra data. Nonetheless, the application of NIR spectroscopy for predicting the table grape ripening quality parameters during the two seasons by means of the portable device SCiO™ sensor allowed to reach promising results.
The data of the 2019 experiment about the comparison between pre-processing operations and data collected on TSS, pH, and TA of Cotton Candy™ are shown in Table 1. The predictive performance for TSS estimation of Cotton Candy™ in 2019 from NIR spectral data collected by means of the SCiO™ sensor was acceptable. In the calibration set of 2019, the TSS (%) values for Cotton Candy™ ranged from 12.3 up to 19.8, acidity from 9.15 down to 3.30 (g/L of tartaric acid) and pH from 3.35 to 4.20. In the validation set, TSS values were from 12.5 up to 19.2, acidity from 9.63 down to 3.30 (g/L of tartaric acid) and pH from 3.31 to 4.20. Generally, a good predictive model should have low RMSE values, an R 2 as close as possible to 1.0, and a RPD over 2.5; therefore the results in Table 1 showed that the parameter with the lowest value of RMSE was pH, with a mean value around m RMSE ≈ 0.07. The acidity is the parameter with the R 2 closest to 1.0, with an average R 2 of m R 2 ≈ 0.95, and with the highest mean RPD value of m RPD ≈ 4.77.
The R 2 value for TSS (0.93; Table 1) was much better with respect to previous studies on other fruit such as feijoa and apple and similar to kiwifruit [5] and other table grape cultivars [35]. Using NIR sensors in wavelength ranges of 780-1700 nm and 680-1000 nm on pear studies, the correlation coefficients resulted of 0.60 and 0.68, respectively, for TSS [55,56]. Higher R 2 values (>0.9) similar to this trial have been reported for kiwifruit using a spectral range from 800 to 1100 nm in McGlone and Kawano [57] and for grape using a spectral range from 800 to 2500 nm [58] but with non-portable devices. The RMSE (0.68) was similar to that reported by McGlone et al. [25] for Royal Gala apple (0.72) and by Donis-González et al. [35] for table grape, but higher than the values obtained by Nicolaï et al. [55] for pear (0.44), Travers et al. [56] for pear (0.62), and McGlone and Kawano [57] for kiwifruit (0.39). However, comparisons between models calibrated with different datasets should be carefully considered even if the same spectral range is covered. In order to ensure a more robust comparison, the same calibration conditions must be kept, i.e., similar number of samples, same cultivar, and same TSS range. Thus, the results of the present study with four cultivars during the ripening process should be carefully compared with other studies with different cultivars and sample size when using different NIR devices [59]. In fact, the present data are in agreement with what was recently reported for three table grape cultivars, Autumn Royal, Timpson Seedless, and Sweet Scarlett [35], using the same SCiO™ sensor.
All combinations of pre-processing operations guaranteed good results with no large differences even though the use of the first derivative followed by the SNV revealed the best results as reported by Donis-González et al. [35] for other seedless table grape cultivars. Looking at the number of latent variables, it decreases evidently by means of the second derivative, which consequently offers lower computational resources maintaining the same level of performances.
From Table 1, the two highlighted rows with the best performances for each parameter were extracted and used for the evaluation of PLSR accuracy, obtaining the results presented in Table 2.  Table 2 showed that the best accuracy belongs to pH with low STD and RMSE, an R 2 close to 1 and a RPD over 20. The good estimation of table grape TSS is probably a consequence of the thin skin of the berry which allowed a good accuracy of the measurements because of appropriate light penetration in the pulp of the berry (where sugars are mainly located) with respect to fruits with thicker skin (feijoa, orange, etc.). Similar values have been reported for other table grape cultivars [35].
The depth of penetration of NIR applied on fruits is about 2-3 mm in the range of 900-1900 nm but it can reach up to 4 mm at a shorter wavelength (i.e., 700-900 nm). In the present study, the depth is consequently around 3-4 mm considering the wavelength region of the sensor (740-1070 nm). Hence, the obtained spectra data were directly correlated to the properties of fruit pulp (outer layers) and skin with a positive effect on the accuracy of both calibration and prediction performance.
The correlation between NIR measurements and the pH was even better than for TSS with a higher R 2 (0.96) and very low RMSE (0.06) values (Table 1). These results were much better than those reported by Gómez et al. [60] in mandarin (R 2 = 0.8; RMSE = 0.18) or reported for Fuji apple (R 2 = 0.87; RMSE = 0.21) by Pourdarbani et al. [14] but using different NIR devices.
The goodness of fit observed for the model estimating the TA was also very high (Table 1). McGlone et al. [25] obtained lower significance for apple (R 2 = 0.38; RMSE = 11.1), whereas Maniwara et al. [61] reported promising results (R 2 = 0.68-0.83; RMSE = 0.22-0.29) in passion fruit but lower than what we found in our data, probably for the thicker skin of passion fruit with respect to berry grape. The good pH and TA predictions are also consequence of the thin skin and presence of organic acids also in the skin and outer layers of the pulp.
The obtained calibration models resulted suitable for characterizing the ripening of Cotton Candy™, since the variations in the quality parameters observed in this study resulted sufficiently wide for an optimal harvesting of the grapes.
In 2020, the TSS measurements were collected for each of the four cultivars, then the datasets were used to calibrate and validate the relative models. Data were also used to create the ripening curves of each cultivar (see Figures 1 and 2). outer layers of the pulp.
The obtained calibration models resulted suitable for characterizing the ripening of Cotton Candy™, since the variations in the quality parameters observed in this study resulted sufficiently wide for an optimal harvesting of the grapes.
In 2020, the TSS measurements were collected for each of the four cultivars, then the datasets were used to calibrate and validate the relative models. Data were also used to create the ripening curves of each cultivar (see Figures 1 and 2).  A comparison between the pre-processing techniques for the four cultivars is presented in Table 3; the PLSR accuracy of the best combinations is shown in Table 4. In the calibration set in 2020, the TSS values for Cotton Candy™ ranged from 3.5 up to 17.6%, are also consequence of the thin skin and presence of organic acids also in the skin and outer layers of the pulp. The obtained calibration models resulted suitable for characterizing the ripening of Cotton Candy™, since the variations in the quality parameters observed in this study resulted sufficiently wide for an optimal harvesting of the grapes.
In 2020, the TSS measurements were collected for each of the four cultivars, then the datasets were used to calibrate and validate the relative models. Data were also used to create the ripening curves of each cultivar (see Figures 1 and 2).  A comparison between the pre-processing techniques for the four cultivars is presented in Table 3; the PLSR accuracy of the best combinations is shown in Table 4. In the calibration set in 2020, the TSS values for Cotton Candy™ ranged from 3.5 up to 17.6%, A comparison between the pre-processing techniques for the four cultivars is presented in Table 3; the PLSR accuracy of the best combinations is shown in Table 4. In the calibration set in 2020, the TSS values for Cotton Candy™ ranged from 3.5 up to 17.6%, for Allison™ ranged from 3.3 up to 19.7%, for Autumncrisp ® ranged from 4.5 up to 17.9%, and for Summer Royal ranged from 4.0 up to 17.6%. In the validation tests, values of TSS were 3.6-16.4% for Cotton Candy™, 3.9-19.3% for Allison™, 5.0-16.9% for Autumncrisp ®, and 4.1-19.2% for Summer Royal. In the calibration models, it is possible to note that the best performances are reported for Autumncrisp ® , with an RMSE average of m RMSE, Aut = 0.50 and consequently a high RPD over 2.5. Nonetheless, all cultivars showed an excellent R 2 value ranging between 0.97 and 0.98. From the computational point of view, all the pre-processing techniques increased the efficiency of the prediction decreasing the number of latent variables successfully. The best combinations among the pre-processing tech-niques always include the logarithmic transformation (LOGT), first (FD) and second (SD) derivative, and standard normal variate (SNV). The major peaks are present at 950-1000 nm in correspondence of a wavelength range of O-H 2nd overtone and N-H 2nd overtone, that represents NH 2 functional groups and H 2 O, ROH, and ArOH (with OH bond on the aromatic group) [62,63]. Table 3. Comparison between pre-processing techniques for each cultivar in the season 2020. In grey background the best pre-processing combinations.  Table 4. PLSR accuracy for each cultivar by means of the best combinations of pre-processing techniques in the season 2020. In grey background the best pre-processing combinations. These groups are related to major constituents of water and sugars such as glucose, fructose, and sucrose of grape. TSS mainly represents sugars but also, to a less extent, other organic molecules (i.e., vitamins, amino acids, hormones, etc.) containing C-C, C-O, O-H, and C-H bonds, and an NIR spectroscopy can be used for a non-destructive measurement [62,64]. After pre-processing of the spectra data, a separation among the different sampling dates appeared in the pre-treatment spectra profiles for each cultivar, as shown in Figure 3. This suggests that the growing and ripening stages (indicated by the TSS values) of table grape berries can be successfully differentiated in the range of 740-1070 nm by pre-treatment processes. other organic molecules (i.e., vitamins, amino acids, hormones, etc.) containing C-C, C-O, O-H, and C-H bonds, and an NIR spectroscopy can be used for a non-destructive measurement [62,64]. After pre-processing of the spectra data, a separation among the different sampling dates appeared in the pre-treatment spectra profiles for each cultivar, as shown in Figure 3. This suggests that the growing and ripening stages (indicated by the TSS values) of table grape berries can be successfully differentiated in the range of 740-1070 nm by pre-treatment processes. The principal component analysis (PCA) was used to detect cluster trend in the spectra data while the pre-processing identified a separation with clear cluster trend as reported in Figure 4 for each cultivar. PCA was able to either separate berries collected at different times during ripening, with differences also among the cultivars, or to determine the primary phenomena in the spectra dataset [65]. Table grape cultivars change their chemical compositions during ripening which allow a discrimination either among the stages or cultivars. The principal component analysis (PCA) was used to detect cluster trend in the spectra data while the pre-processing identified a separation with clear cluster trend as reported in Figure 4 for each cultivar. PCA was able to either separate berries collected at different times during ripening, with differences also among the cultivars, or to determine the primary phenomena in the spectra dataset [65]. Table grape cultivars change their chemical compositions during ripening which allow a discrimination either among the stages or cultivars.

Cultivar
A partial least squares regression (PLSR) model was used for the determination of TSS for all the cultivars ( Figure 5) and the measured values reported a linear correlation with NIR predictions. As reported in Table 4, the best pre-processing combinations resulted LOGT-FD-SNV for both Cotton Candy™ and Allison™, and LOGT-SD-SNV for both Autumncrisp ® and Summer Royal. These data for the four cultivars indicate that proper pre-processing techniques are useful to improve the accuracy of the PLS model [66]. After the pre-processing techniques used (LOGT, FD or SD, SNV), the multivariate models obtained with NIR measurements predicted the TSS (%) values.
Autumncrisp ® resulted in the cultivar with the lowest RMSE and the highest RPD (Table 4) in the prediction model, whereas Summer Royal was the cultivar presenting the lowest prediction accuracy. Nevertheless, all the cultivars allowed to build excellent PLSR models with a RPD value over 6. In line with the results of the TSS range analysis, it seems clear that absolute error indexes such as RMSE are able to provide a higher reliability than R 2 in the evaluation of the model performance through different datasets. Therefore, the RMSE can be preferred to R 2 when the prediction accuracy is evaluated for short time periods [59,67].
Since we did not use internal cross validation to assess the performance of the models, but instead an independent dataset (test) from a sample apart from the calibration dataset, the results provide a more realistic reliability of the device for the prediction of unknown samples of ripening table grape berries. The robustness of calibration models across orchard blocks and between seasons represents a critical issue for determining the use of non-destructive techniques [68] and consequently should not be overlooked. The predictive accuracy of the SCiO™ sensor can be affected by the homogeneity and surface properties of the fruit, the nature of the data collected, and wavelength range; hence a large sample should be used across the orchard and the point of illumination should be carefully chosen avoiding points with damages, diseases, sunburn, etc. SCiO™ sensor performed well for the determination of dry matter in apple fruit with an RMSEP value of 0.45, very close to a benchtop spectrophotometer (0.451), but poorly with dry matter of kiwifruit [31]. However, for the four table grape cultivars investigated in the current study, qualitative analysis of ripening showed interesting results. The capability of this device to distinguish berries for TSS, pH and acidity demonstrated the potential for portable NIR spectroscopy to be used as a sorting/grading tool both in the field and in the factory. From a farmer's point of view, the spatial variability of TSS accumulation during the season, when used in combination with a GPS system, can allow the geo-referencing of the measurements for the different locations/cultivars/blocks of the vineyard/farm. This information can also be very important in the application of precision viticulture strategies aimed at performing selective harvesting, not only for table grape but also for wine grape cultivars. Data on two tomato selections indicated that the SCiO™ can be also used for the prediction of firmness, dry matter and TSS with good to high accuracy for TSS with R 2 of 0.92 and RMSE of 0.453 [69] and dry matter content was recently predicted in avocado fruit where a prediction R 2 of 0.71 was obtained [70]. The SCiO™ correctly predicted 100% of adulterated samples (with salt, sawdust, or starch) and 95.6% of the authentic coriander samples in a recent study in order to be used as screening and rapid technique directly on site rather than in lab [30].  A partial least squares regression (PLSR) model was used for the determination of TSS for all the cultivars ( Figure 5) and the measured values reported a linear correlation with NIR predictions. As reported in Table 4, the best pre-processing combinations resulted LOGT-FD-SNV for both Cotton Candy™ and Allison™, and LOGT-SD-SNV for  The SCiO™ sensor, when compared with lab spectrophotometers, showed good performances, generally with lower R 2 or higher RMSEP, and can be considered to predict some fruit quality parameters as recently reported for mango firmness [71]. The laboratory-based spectrophotometers have lower errors because of a broader spectral range captured, covering the 1st, 2nd, and 3rd overtones of the N-H, O-H and C-H bonds whereas the SCiO™ is able to capture only the 740-1070 nm range thus explaining 3rd overtones of bonds [71]. Despite the positive aspects of the handheld SCiO™ sensor, its spectral range is limited with a consequent lack of absorption information related to the presence of carbohydrates, starch, or other possible components which can be better detected by laboratory NIRS instruments [72], and it probably limits the predictive ability for complex nutritional parameters [73], such as mineral content in fruits. Minerals, unlike organic molecules, can only be detected if chelated in organic complexes or indirectly in case there is an effect on hydrogen bonds [74]; however, when their form is inorganic, the identification and prediction is difficult [72].
However, when a good model performance is associated with portability, ease-ofuse, low cost, ability to use with mobile phones and a connected cloud framework, the SCiO™ sensor (or similar devices) can be a valid alternative to traditional laboratory-based spectrophotometers [70] to be used by a wide number of users.
The chemometric indexes for TSS models of the four cultivars indicated that the NIR spectra region (740-1070 nm) was able to predict the TSS across the range of 3.6-19.3% and can be used for non-destructive determination of TSS quality attributes in fresh table grape cultivars. More chemometrical information is also available at the higher end of the NIR spectrum (1150 to 2500 nm), but although the SCiO™ is not able to acquire such wavelengths, data resulted affordable for some qualitative characteristics of table grape cultivars.
Apart for prediction for fruits and other horticultural products, the SCiO™ can provide a rapid prediction for the content of both intact casein and total protein in cheddar cheese [75]. The SCiO™ sensor was also successfully applied for the determination of total and gelatinized starch in dog food and partially for S and K content, whereas it was not useful for insoluble fibers and other mineral elements which showed RPD values much lower than what we found in our data [72].
The model failure for fresh fruit is commonly related to a high biological variability which can be related to several factors such as: cultivars, sites of cultivation, cultural practices, season of harvest, ripening stages of fruit, and storage conditions [37,76,77]. Consequently, a natural solution to deal with the calibration failure is to measure a wide range of samples from different cultivars and harvesting seasons (2-3 seasons) and developing/ripening stages to calibrate global models to be used worldwide.

Conclusions
A portable device such as SCiO™ can support the non-destructive prediction of table grape TSS, together with pH and TA. Rapid estimation of such quality and ripening parameters with portable sensors are effective tools for the ripening protocols of table grape, thus, improving the whole supply chain and reducing both costs and fruit losses along the supply chain. Predictive models can be used for estimate quality/ripening parameters thus supporting agronomical consultants, farmers, and retailers to obtain clear information of the ripening status of the grapes with fast and on-site monitoring. Moreover, this method is non-destructive, therefore it allows to collect many data without losing or destroying the berry. Generally, the most robust combination with the best performances was represented by the use of the logarithmic transformation, the first/second derivative, and SNV operation.
The use of these models, which can be easily imported into mobile phone technology, definitely has a high potential for effective, rapid, and simple application in many fields (orchards, post-harvest, retailers, etc.), and may be the road to the future.

Data Availability Statement:
The data presented in this study are available on demand from the first author at giuseppe.ferrara@uniba.it.