Abstract
Background and goals Machine learning (ML) and statistical modeling have emerged as important innovations in science. In wine research, these methods are often employed to predict abstract parameters, such as wine quality, based on complex instrumental chemical analysis. This study compares the use of three ML algorithms—logistic regression, support vector machine (SVM), and eXtreme Gradient Boost (XGBoost)—to distinguish blanc de noir wines from white and rosé wines on the basis of spectrophotometric data.
Methods and key findings The present study of 176 commercial wines uses both spectrophotometric data and CIE L*a*b* coordinates created from dimensional reduction of the transmission data. The transmission spectra were used to train the extreme gradient-boosted trees and SVM models. CIE L*a*b* coordinates were used to train SVM and logistic regression models. After hyperparameter tuning, the use of the SVM model on the CIE L*a*b* data provided optimal classification, with a cross-validated accuracy of 0.88 and an F1 score of 0.93.
Conclusions and significance The dimensional reduction of spectrophotometric data for use as input to train ML models can both provide accurate ML results and simplify the use of ML algorithms for potential users. The final classification model is deployed in a browser-based user-friendly dashboard for winemakers and other users, such as wine laboratories.
Introduction
Machine learning (ML) and statistical modeling are among the most important recent innovations in scientific research. The goal of statistical modeling is to draw conclusions about a population based on observed samples. The traditional approach is to make assumptions about the underlying data set using mathematical formulation. In contrast, ML focuses on developing models that can learn patterns from a given data set without being explicitly programmed to do so, seeking generalization rather than inference. In ML, algorithms (including statistical models) are designed to make the most accurate qualitative or quantitative predictions. Qualitative predictions include classification, in which ML models use a given data set to predict the presence or absence of a feature. Quantitative predictions rely on regression, wherein the cardinality of the target feature is predicted based on the given data set. These algorithms learn from structured or unstructured input data and apply the results from this learning process to new data.
ML is already an established tool in many domains of the natural sciences. For example, Hsich et al. (2011) introduced an ML model based on random survival forests, a tree-based method derived from the random forest approach (Breiman 2001, Ishwaran et al. 2008), which identified risk factors for the survival of patients with systolic heart failure. Other studies have used ML as a tool to improve breast cancer diagnostics (Beck et al. 2011) and used spectroscopic data such as Fourier transform infrared (FTIR) spectroscopy to predict sarcomas and glial abnormal growth (Ramirez et al. 2021).
In wine research, the use of ML algorithms is increasing. The main focus of current research is to predict abstract parameters such as wine quality, on the basis of complex instrumental analytical procedures (Kumar et al. 2020, Shaw et al. 2020, Bhardwaj et al. 2022). One study used a red wine data set from the University College London (UCL) ML repository, which includes analytical parameters such as acidity, sugar, and free and total sulfur dioxide, to predict perceived wine quality using various algorithms, including naive Bayes, random forest, and support vector machine (SVM) (Kumar et al. 2020). Another study used a mixture of real and synthetic data based on 47 volatile components (mainly alcohols and esters) and parameters including pH, alcohol, and anthocyanin level, to predict the quality of New Zealand Pinot noir (Bhardwaj et al. 2022). Other research also used the UCL ML repository red wine data set to predict wine quality with SVM, random forest, and multilayer perceptrons (Shaw et al. 2020). Each of these studies used ML to predict quality parameters that are important when wine is already produced. However, no publications were found that used ML during wine production or with parameters such as spectroscopic data as input, although this technique is established in other fields (Ramirez et al. 2021).
Wine color is an important analytical quality parameter; it can influence the olfactory and gustatory perception of wine (Morrot et al. 2001, Nguyen and Durner 2023) and is an important purchase driver and typicality parameter for consumers (Parpinello et al. 2009, Coulon-Leroy et al. 2018, Issa-Issa et al. 2021). In addition, the color of some wines, such as blanc de noir, is regulated by law in some countries (Bundesrat 2021). Blanc de noir is a very light, unsaturated, colored wine produced from red grapes that are processed in the same way as white grapes (Bundesrat 2021). Because blanc de noir wines are made from red grapes, the very light color of these wines directly influences consumer acceptance (Ellis and Kok 1987). It is sometimes very difficult to visually distinguish between blanc de noir and rosé wines, as well as between blanc de noir and white wines. Commercial blanc de noir wines have a wide color range, including colors similar to those of rosé and white wines, making it challenging to establish a universal color threshold to distinguish blanc de noir wines.
For color determination, high-dimensional data from transmission spectra can be reduced to only three dimensions via the L*a*b* color space of the Commission Internationale de l’Eclairage (CIE). The CIE L*a*b* color space is a Cartesian coordinate system, in which the L* value represents the lightness of a color, the a* value represents either the red component (+a*) or the green component (-a*) of a color, and the b* value represents either the yellow component (+b*) or the blue component (-b*) of a color. The CIE L*a*b* color space is recommended by the International Organization of Vine and Wine (OIV) for the determination of wine color (OIV 2024) and is also effective for representing the visually perceived color of wine (Hensel et al. 2023).
In addition to the transmission spectrum, calculation of the CIE L*a*b* coordinates (ISO/CIE 11664-4:2019) requires a color-matching function of the standard observer (ISO/CIE 11664-1:2019) and the power distribution of a standard illuminant (ISO/CIE 11664-2:2022). The color-matching functions of the standard observer were developed experimentally. The spectral sensitivity of the eye was evaluated with three primary valences: red, green, and blue (Wright 1929, 1930, Guild 1931, Stiles and Burch 1959). The current standard is the D65 illuminant, representing natural daylight on a sunny day and the 10° standard observer (ISO/CIE 11664-2:2022). Dimensionality reduction by transforming transmission spectra into CIE L*a*b* coordinates has the advantage of enhanced comprehensibility for users, allowing a more intuitive representation of the color data that is aligned with human perception. However, most ML algorithms do not produce reliable results from data sets with only three dimensions. In contrast, a transmission spectrum provides an abundant number of dimensions, allowing the use of most ML algorithms (Nolasco Perez et al. 2018, Hossain et al. 2020, Chopra et al. 2021).
One of the most basic models for binary classification is logistic regression, a special form of regression analysis that uses nominal-scaled dependent variables instead of the interval-scaled dependent variables used in linear regression models. Logistic regression calculates the probability of an event from the natural logarithmic ratio between its occurrence and non-occurrence (log-odds). The logistic function converts log-odds to probability. A more complex ML algorithm for binary classification is the SVM, which is well suited for data sets with a limited number of variables, such as the well-known Iris data set (Fisher 1936). Binary classification is achieved by locating support vectors in a higher-dimensional feature space and constructing a suitable hyperplane based on the location of the support vectors. The simplest form of SVM is the maximal margin classifier or hard-margin SVM (Boser et al. 1992). In this case, the margin signifies the smallest distance between the hyperplane separating the two classes and the nearest sample point to the hyperplane. A hard-margin SVM is only applicable to data that are linearly separable, and therefore it is rarely used. The better option for “real-world” data (i.e., often with outliers or overlapping classes) is the soft-margin SVM, which allows a certain degree of misclassification. The occurrence of overfitting is thus reduced, and a better generalization is possible (Bennett and Campbell 2000).
If transmission spectra in the visual wavelength area are used, more complex algorithms such as eXtreme Gradient Boost (XGBoost) can be applied. XGBoost is an ensemble learning method that uses a unique method to build decision trees sequentially, with every new tree designed to correct the errors made by the previous tree. For this purpose, XGBoost uses L1 (Lasso regression) and L2 (Ridge regression) regularization to prevent overfitting. Furthermore, a common problem with “real-world” data is missing data, for which XGBoost has an intrinsic coping mechanism (Chen and Guestrin 2016).
The goal of this study was to develop an ML application to classify commercial blanc de noir wines on the basis of their transmission spectra and CIE L*a*b* coordinates, thereby distinguishing the blanc de noir wines from “not blanc de noir wines” (a category consisting of rosé and white wines). For this purpose, the dimensional reduction of transmission spectra to CIE L*a*b* coordinates for use in combination with logistic regression and SVM was compared to the more complex combination of using transmission spectra directly for SVM and XGBoost modeling. To make the classification model accessible to wine chemists and winemakers, a browser application was developed with a dashboard that compares the spectrophotometric data of unknown wine samples to a given data set of commercial wines. Spectrophotometric data of unknown wines can easily be obtained from any photometer or low-cost photometric devices (Di Nonno and Ulber 2021, 2022, Hensel et al. 2022).
Materials and Methods
Samples
The sample set consisted of 176 commercial wines (82 blanc de noir, 56 white, and 38 rosé wines) from Germany, France, Italy, Australia, Spain, Belgium, and Turkey, with vintages from 2020 to 2022. The blanc de noir grape varieties were Pinot noir, Cabernet Sauvignon, Pinot Meunier, Dolcetto, Portugieser, Pinot Madeleine, and St. Laurent; white wines were Riesling, Gewürztraminer, Sauvignon blanc, Pinot gris, Pinot blanc, and Chardonnay; and rosé wines were Pinot noir, Cabernet Sauvignon, Cabernet franc, Merlot, Sangiovese, Blauer Zweigelt, Lemberger, Grenache, Cabernet Cortis, Bobal, Muskattrollinger, Montepulciano, and Syrah. The samples were stored at 8°C in the 0.75-L bottles provided by the producers. One bottle of each wine was used for the study. The bottle type, closure material, bottle age, experiment date, and wine compositional data are shown (Supplemental Table 1).
Basic wine analysis
Ethanol, residual sugar, titratable total acidity, and pH were determined by FTIR spectroscopy (Foss WineScan FT120 Basic). An in-house calibration “white wine” was used for the white wines and blanc de noir wines. For rosé wines, an in-house calibration “rosé wine” was used. Free and total SO2 were determined with iodometric titration by the Ripper method using the Titrator T50 (Mettler Toledo).
Photometric measurement and CIE L*a*b* computation
To obtain the color data, the transmission spectra of the wines were recorded in triplicate between 360 and 780 nm, with a scan speed of 1000 nm/min and a data interval of 1 nm. These parameter settings provide the most reproducible results (Hensel et al. 2022). The blanc de noir and white wines were measured in 10-mm cuvettes (Brand), and the rosé wines were measured in 1-mm flow cuvettes (Hellma). Distilled water was used as a blank measurement. In compliance with OIV recommendations, the transmission spectra of the rosé wines were referred to a 10-mm path length (OIV 2024). CIE L*a*b* coordinates were computed from averaged transmission spectra using the 10° standard observer and the D65 standard illuminant, according to the literature (ISO/CIE 11664-1:2019, ISO/CIE 11664-2:2022).
Data pipeline
The computation steps starting from the transmission spectra of all wines are depicted (Figure 1). The transmission spectra were transformed into CIE L*a*b* coordinates and preprocessed via the RobustScaler, in which the median and the interquartile range were used to scale the data. Logistic regression was applied only to preprocessed CIE L*a*b* coordinates. SVM was applied to preprocessed CIE L*a*b* coordinates and the preprocessed transmission spectra. XGBoost was applied only to full transmission spectra without preprocessing.
Data pipeline starting from the transmission spectra as raw data and following through the different computation steps. Colors indicate different models: logistic regression on CIE L*a*b* (red), support vector machine (SVM) on CIE L*a*b* (blue), SVM on transmission spectra (yellow), and eXtreme Gradient Boost (XGBoost) on transmission spectra (green).
A full factorial hyperparameter tuning (grid search) on 70% of the data set (training data) with a five-fold cross-validation was used to find the optimal parameters for each model. Application of the optimized models on the test data facilitated the validation of the models. The accuracy of the five subsets was averaged, hereafter referred to as “accuracy”. Validation was repeated 100 times, including shuffled splitting of the training and test data in each repetition (different random seed for each repetition). This repeated validation allowed for a conservative estimation of the classification variance. On the basis of the test data set, confusion matrices were calculated to compare actual and predicted classifications. The accuracy parameter considers only the true positive and true negative counts; thus, accuracy may be inflated by a high number of true negative predictions. Therefore, to validate the accuracy as a parameter, the F1 score—which considers both the false positive and false negative counts—was calculated with the following equation:
in which TP is the true positive count, FP is the false positive count, and FN is the false negative count.
Logistic regression
Logistic regression was used as a reference model due to its simplicity. The logistic regression was trained and tested with the preprocessed CIE L*a*b* data. Hypertuning was performed with the L2 penalty function and a regularization parameter (C) between −4 and 4, randomly distributed on a logarithmic scale. To start the logistic regression, the data were mapped between 0 and 1 with the logistic function. Logistic regression creates a model that calculates the probability of the dependent variable Y based on independent variables according to the following equation:
in which P(Y = 1) is the probability that the dependent variable Y is 1, β0 is the intercept of the y-axis, and β1 is the coefficient for the corresponding dependent variable x.
SVM
A soft-margin SVM was used to increase the flexibility of the algorithm. The optimization problem, described as the maximization of the margin with the fewest number of misclassifications, can be solved with the kernel functions listed in Table 1.
Kernels used and regularization parametersa. RBF, radial basis function.
The following hyperparameters were optimized: kernel (linear, polynomial, radial basis function [RBF], and sigmoidal), penalty for misclassification C (between 1 and 50), and polynomial degree (2, 3, 4 for the polynomial kernel). The parameter controlling the individual impact of each data point on the construction of the hyperplane γ was set to different values depending on the data input. For CIE L*a*b* data, γ was set between 0.01 and 0.9 for the polynomial, RBF, and sigmoidal kernel. For full transmission spectra, γ was set more restrictively between 0.001 and 0.009 because of the significantly larger number of features.
XGBoost
XGBoost was applied only to the unprocessed transmission spectra. A range of conservative hyperparameters were used for model optimization, to minimize the possibility of overfitting due to the flexibility of the algorithm and the large number of variables. The following optimization parameters were chosen: maximum number of estimators (1, 10, 25), maximum depth of estimators (1, 2, 3), learning rate (0.01, 0.05, 0.1), gain (0, 0.25, 1), L2 regularization (0, 1, 10), and ratio between positive and negative classes (1, 3, 5). The fraction of the training samples (subsample) was set to 90%. The fraction of features (colsample_bytree) was set to 50%. The binary logistic objective function was used.
Software and data analysis
The computation of the CIE L*a*b* coordinates from the transmission spectra was performed using the JASCO spectra manager ver. 2.15.01. Data preprocessing, model construction, and model performance evaluation were then performed using Python 3 with the following libraries: NumPy (Harris et al. 2020), pandas (PDT 2024), scikit-learn (Pedregosa et al. 2011), seaborn (Waskom 2021), matplotlib (Hunter 2007), and XGB (Chen and Guestrin 2016). The Plotly and Dash libraries (as found on the website https://plot.ly) were used to program the browser application “Blanc de Noir Check”.
Results
Boxplots of CIE L*a*b* coordinates are shown (Figure 2). No significant differences were observed between the two classes “Blanc de noir” and “Not Blanc de noir” for any of the three coordinates. Accordingly, classification with only one of the CIE L*a*b* coordinates seems to be impractical. From a statistical standpoint, the classification problem is not univariate. The descriptive statistics of the CIE L*a*b* coordinates for all 176 wines in this study are provided (Supplemental Table 2), and further information on the overlap of the transmission spectra is shown (Supplemental Figure 1).
Boxplots of each CIE L*a*b* coordinate for the two classes “Blanc de noir” and “Not blanc de noir”. The median line, 25% and 75% quantiles, and outliers are shown. The whiskers represent the 1.5 interquantile range.
The accuracy of all optimized models (logistic regression on CIE L*a*b*, SVM on CIE L*a*b*, SVM on transmission spectra, and XGBoost on transmission spectra) with the training data set is displayed as boxplots (Figure 3). During hyperparameter tuning, every possible parameter combination was used to calculate the accuracy of the prediction. Overall, the best classification was achieved with SVM (RBF kernel) on full transmission spectra (with an accuracy of 0.93), closely followed by SVM (RBF kernel) on CIE L*a*b* coordinates (with an accuracy of 0.88; C = 21 and γ = 0.8). However, in the validation of the SVM trained on transmission spectra with the test data set, the accuracy was 0.85, almost 10% lower than the accuracy for the training data set (0.93), indicating overfitting. Therefore, the hyperparameter setting with the smallest distance between the accuracies of the training and test data was selected as the optimal parameter setting, with an accuracy of 0.88 using SVM on transmission spectra with the training data set (C = 1 and γ = 0.005). The data points in Figure 3 show the accuracy of the optimal parameter settings, in which the accuracies of the training and test data are as close as possible.
Accuracy of the parameter-optimized models after hyperparameter tuning, displayed as boxplots comparing logistic regression, support vector machine (SVM), and eXtreme Gradient Boost (XGBoost) algorithms as well as the input data (CIE L*a*b* coordinates and transmission spectra). The boxplots contain quantile 1, the median line, and quantile 3. The whiskers display the 1.5-fold interquantile range; the rhombi are outliers. The data points indicate the most accurate of the most suitable hyperparameter settings. The SVM algorithm is conducted with the (A) linear kernel, (B) radial basis function kernel, (C) polynomial kernel, and (D) sigmoidal kernel.
With the simplest model, logistic regression on CIE L*a*b* coordinates, a maximum accuracy of 0.77 (with C = 11.51 and L2 regularization) could be achieved. However, the accuracy of the training data was 8% higher than the accuracy of the test data, also suggesting overfitting (Figure 3). For SVM trained on CIE L*a*b* coordinates and transmission spectra, the RBF kernel was the best possible kernel for both data types. When transmission spectra were used instead of CIE L*a*b* coordinates to train the SVM, the accuracy of the linear and polynomial kernel increased, whereas the accuracy of the sigmoidal kernel decreased. The hyperparameter-optimized XGBoost model showed an accuracy of 0.85 (n_estimators = 25, max_depth = 3, learning rate = 0.05, gain = 0.25), which is very close to the 0.88 accuracy of the best model (SVM RBF trained on CIE L*a*b* coordinates).
The results displayed in Figure 3 allow an in-depth comparison between the different kernel functions of SVM, logistic regression, and XGBoost on one training/test data split. To ensure that the high accuracies were not caused by data leakage, the cross-validation score was computed by comparing data scaling before and after data splitting. The differences between the two approaches were marginal (Table 2). The difference in accuracy of the logistic regression on CIE L*a*b* was 0.008 for the test data set and 0.020 for the training data set. The difference in accuracy of SVM on CIE L*a*b* was 0.015 for the test data set and 0.007 for the training data set. Similar results were observed for SVM trained on transmission spectra, with differences in accuracy of 0.019 for the test data set and 0.016 for the training data set.
Cross-validation scores (CVS) of the pre-test for data leakage. SVM, support vector machine.
To obtain a more conservative estimate of the variance of classification, the complete model optimization was repeated with 100 random splits of the training and test data. Figure 4 shows the highest accuracy of the optimized models after hyperparameter tuning for each training and test data set. The difference in the accuracy values for the different training/test data splits was similar for all models. Relative standard deviations (RSD) of the training data set were as follows: SVM trained on CIE L*a*b* (1.85%), SVM trained on transmission spectra (1.75%), XGBoost trained on transmission spectra (2.83%), and logistic regression trained on CIE L*a*b* (3.55%). To make a generalized assumption, the 100 test data sets were also evaluated. The spectra-trained SVM showed an RSD of 3.11% for the test data sets, and the SVM trained on CIE L*a*b had an RSD of 3.55%. This repetitive approach of model optimization revealed that XGBoost had higher classification variation than the SVM models. The test data sets showed an RSD of 5.1%, which is closer to the logistic regression of 6.5%.
Highest accuracy of the optimized models after hyperparameter tuning for each training and test data set, with 100 randomized training data sets and the corresponding test data sets. The boxplots show quantile 1, median line, and quantile 3. The whiskers depict the 1.5-fold interquantile range. SVM, support vector machine; XGBoost, eXtreme Gradient Boost.
To gain further insight into model performance, confusion matrices were built using the test data set for the optimized models. Overfitting of the logistic regression could be substantiated by the confusion matrix displayed in Figure 5. The F1 score of the logistic regression for the test data set was 0.72; a higher value of 0.77 was obtained for the training data set, which indicated overfitting. The poor performance could be explained by the simplicity of the algorithm. SVM is slightly more complex than logistic regression. The confusion matrix of the SVM trained on transmission spectra yielded F1 scores of 0.94 for the test data set and 0.91 for the training data set. Very similar F1 scores were obtained from SVM trained on CIE L*a*b* coordinates, with 0.93 for the test data set and 0.92 for the training data set. The optimized XGBoost model resulted in F1 scores of 0.92 for the test data set and 0.93 for the training data set.
Confusion matrices for the test data set (n = 53) of the used algorithms: logistic regression trained on CIE L*a*b* data, support vector machine (SVM) on CIE L*a*b* data, SVM on transmission spectra, and eXtreme Gradient Boost (XGBoost) on transmission spectra, as well as the F1 scores for the test and training data sets (n = 128).
Figure 6 shows the sensitivity of the parameter settings, evaluating the effect of changing parameter settings on model performance. For logistic regression trained on CIE L*a*b* coordinates, the majority of the parameter settings yielded an accuracy ~0.7 (Figure 6A). For SVM trained on CIE L*a*b* and transmission spectra, the sensitivity was split between the different kernel functions (Figure 6B and 6C). Within the RBF kernel, the majority of the parameter settings yielded an accuracy of 0.88 (Figure 6B). For the XGBoost model, the majority of the parameter setting accuracies were between 0.45 and 0.55, with outliers of up to 0.85 (Figure 6D).
Deviation of the accuracies depending on the parameter settings of logistic regression on (A) logistic regression trained on CIE L*a*b* data, (B) support vector machine (SVM) on CIE L*a*b* data, (C) SVM on transmission spectra, and (D) eXtreme Gradient Boost (XGBoost) on transmission spectra. The results show that logistic regression is a robust model but has the lowest accuracy. SVM is robust in general, however, a change of the kernel function can lead to a significant shift. XGBoost is not a robust model, as most of the results were relatively low compared to the best model, indicating that an alteration of parameters can lead to a significant change in performance. RBF, radial basis function.
Figure 7 depicts the decision boundaries for the three possible projection planes of the CIE L*a*b* color space of the optimized SVM model shown in Figure 3. In the L*a* color plane (Figure 7A), the decision boundary and the margin separated the blanc de noir wines from the rosé and white wines. This is not the case in the L*b* color plane (Figure 7B), in which the blanc de noir wines could not be distinguished from the rosé and white wines. The a*b* color plane, like the L*a* color plane, showed a distinct decision boundary and margin (Figure 7C).
Visualization of the separating hyperplane in the (A) L*a*-projection, (B) L*b*-projection, and (C) a*b*- projection. The dashed lines indicate the margin in which misclassifications can occur. The solid line indicates the decision line between the blanc de noir, white, and rosé wines.
Discussion
When transmission spectra were used as input data for SVM, the risk of overfitting was relatively high compared to SVM trained on CIE L*a*b* coordinates; this was a result of the high number of features and the relatively low sample size (Figure 3). Overfitting can be caused by co-linearity among the features in the transmission spectra. A transformation of the high-dimensional transmission spectra (420 dimensions) to low-dimensional CIE L*a*b* coordinates (three dimensions) mitigates the co-linearity and decreases the risk of overfitting. Other researchers using data with a large number of features and a relatively small sample size have also observed overfitting due to co-linearity (Xiong et al. 2019); therefore, reducing the features for this data set seems to be the optimal approach.
Despite being less affected by co-linearity in comparison to SVM and logistic regression, XGBoost was not the optimal algorithm, given its flexibility. In another study, the performance of XGBoost was shown to plummet when the data set was too small (Zou et al. 2022). Although the accuracy of XGBoost was relatively high for this data set, the limited sample size could lead to an unstable model that produces unstable results when new data is presented. This could also explain the relatively high RSD for the test data set. The RSDs of the test data sets were generally higher than the RSDs of the training data, likely because the training data sets are known to the algorithm, whereas the test data sets are unknown to the algorithm (Figure 4).
Dimensionality reduction of full-transmission Visspectra to CIE L*a*b* coordinates reduced the risk of overfitting. CIE L*a*b* coordinates are also more intuitive for potential users, as it is easier to visualize the decision boundary of the SVM for the three dimensions of the CIE L*a*b* color space, compared to the 420 dimensions of the transmission data. Therefore, SVM with the RBF kernel trained on CIE L*a*b* data was considered the optimal model for further development.
The confusion matrices confirmed that SVM is the most suitable model for the differentiation of blanc de noir wines from rosé and white wines (Figure 5). In contrast, logistic regression is not well suited for this purpose. Although it is difficult to compare the performances of different algorithms from different studies, the performance of the SVM in this study is comparable to the performance of SVM using the Iris data set and can therefore be considered highly efficient (Fisher 1936). No direct comparison with other literature on wine ML research was possible. However, an indirect comparison with two previous studies (Kumar et al. 2020, Bhardwaj et al. 2022) showed that the F1 scores and accuracies of the SVM on CIE L*a*b* were higher in our study, although the goals of these publications were much more difficult to achieve. The only conclusion to be drawn from this observation is that SVM trained on CIE L*a*b* coordinates is more suitable for the objective of the current study than for the objectives of the referenced literature (Kumar et al. 2020, Bhardwaj et al. 2022).
Regarding the sensitivity of the models visualized in Figure 6, the logistic regression model was found to be robust but not very accurate, suggesting that the model is too simple. The SVM, regardless of the input, yielded a robust model within one kernel. This shows that the kernel function was the most sensitive parameter and should not be changed. The other parameters had a marginal impact, making the model extremely robust. CIE L*a*b* coordinates were found to be more robust than transmission spectra, as the parameter settings yielded a higher deviation with the transmission spectra. The sensitivity evaluation for XGBoost showed the opposite, with most of the results between 0.45 and 0.55. Thus, this model was not suitable because a change of the parameters caused a huge change in accuracy. XGBoost was the most sensitive model.
The low resolution in the L*b* color plane in Figure 7B can be explained by the absence of red-colored anthocyanins in white wine. Rosé and blanc de noir wines are produced from red grapes and therefore contain a certain amount of anthocyanins. Consequently, the a* value is more important than the b* value. The high number of support vectors between blanc de noir wines and white wines in Figure 7A and 7C indicate that differentiation between these two classes is more difficult. This aligns with findings from prior acceptance-threshold studies, in which visual differentiation of blanc de noir and white wines was shown to be difficult (Ellis and Kok 1987).
Conclusion
This study assessed the applicability of logistic regression, SVM, and XGBoost to classify wines on the basis of spectrophotometric data. SVM outperformed both logistic regression, which was too simple, and XGBoost, which was too flexible. In both cases, the models produced unstable results. The RBF kernel showed the best performance for the classification of blanc de noir wines with SVM trained on either CIE L*a*b* coordinates or transmission spectra. The dimensional reduction from transmission spectra to CIE L*a*b* coordinates using SVM resulted in no significant difference from SVM trained with transmission spectra. However, comprehensibility and usability increased significantly, as only three parameters are needed for the classification. Therefore, SVM trained on CIE L*a*b* coordinates can be considered the most suitable model for this application. The use of transmission spectra as training input for SVM also led to a higher risk of overfitting due to co-linearity between the transmission values of different wavelengths, a risk which can be mitigated by dimensional reduction to CIE L*a*b* coordinates. Furthermore, visualization of the decision boundaries in the three color planes showed that the a* coordinate is essential for the classification of blanc de noir wines.
To make this ML algorithm available to lab technicians and winemakers, we developed an interactive, user-friendly, graphic user interface in the form of a dashboard. For this purpose, the Plotly Dash library was used in Python. The user only needs to input the CIE L*a*b* coordinates of their wine to the application, and the wine is classified according to the parameter-optimized SVM model. The browser application can be reached online with the following link: https://blancdenoircheck-217f19ee6419.herokuapp.com.
Supplemental Data
The following supplemental materials are available for this article in the Supplemental tab above:
Supplemental Table 1 Metadata, basic wine composition, and experimental environments of the wines.
Supplemental Table 2 Descriptive statistics of the CIE L*a*b* coordinates of all 176 wines.
Supplemental Figure 1 Mean transmission spectra of white wines (n = 56), blanc de noir wines (n = 82), and rosé wines (n = 38). The solid lines show the mean spectra; opaque areas show the range of the data set.
Footnotes
The authors thank the working group of Maren Scharfenberger-Schmeer, as well as Roland Ulber and Sarah Di Nonno, from RPTU Kaiserslautern-Landau for their input and support as project partners. Furthermore, the authors thank Thi Nguyen for assistance with the English language and his ideas during the finalization of this manuscript. Finally, the authors thank Marc Weber for his support with programming and the initial discussions leading to this manuscript. This work was financially supported by the Arbeitsgemeinschaft Industrieller Forschungsvereinigungen (AiF) “Otto von Guericke” e.V. (project number: AIF 20964 N).
Hensel M, Vestner J, Fahrer J and Durner D. 2025. Evaluation of machine learning algorithms to classify Blanc de noir wines with spectrophotometric data. Am J Enol Vitic 76:0760006. DOI: 10.5344/ajev.2024.24029
By downloading and/or receiving this article, you agree to the Disclaimer of Warranties and Liability. If you do not agree to the Disclaimers, do not download and/or accept this article.
The data underlying this study are available on request from the corresponding author.
- Received May 2024.
- Accepted December 2024.
- Published online March 2025
This is an open access article distributed under the CC BY 4.0 license.













