Abstract
This paper investigates the use of least squares support vector machines and Gaussian process regression for multivariate spectroscopic calibration. The performances of these two non-linear regression models are assessed and compared to the traditional linear regression model, partial least squares regression on an agricultural example. The non linear models, least squares support vector machines, and Gaussian process regression, showed enhanced generalization ability, especially in maintaining homogeneous prediction accuracy over the range. The two non-linear models generally have similar prediction performance, but showed different features in some situations, especially when the size of the training set varies. This is due to fundamental differences in fitting criteria between these models.
Keywords
Background
The problem of interest is the prediction of the concentration of a chemical constituent in a sample from its near-infrared (NIR) spectrum. A set of calibration samples is used to learn the quantitative relationship between the constituent concentration and NIR absorption spectrum. In general, spectral data sets are high-dimensional and require dimensional reduction. Traditional linear regression methods (including principal component regression (PCR) and partial least squares regression (PLSR)) first transfer raw spectral data into latent variables to reduce dimensionality of regressors, and then directly implement multiple linear regression on latent variables. These methods perform reasonably well in most practical applications. However, in some cases, e.g. when predictions are required over a large range so that nonlinearity occurs, linear models fail to keep their accuracy across the range. Non-linear regression models are then relevant. Popular non-linear models include support vector machines (SVMs), artificial neural networks (ANNs), and Gaussian process regression (GPR). Previous studies have shown that SVMs 1 and GPR 2 can be applied to multivariate spectroscopic calibration. Numerous feasibility studies have proven SVM is a very powerful tool on spectroscopic analysis, such as identification of teas, 3 quantification of milk powder, 4 classification of colonic tissues, 5 and quantitative calibration on tobacco. 6 GPR is a relatively new method for spectroscopic calibration, and previous studies have shown its superiority on modeling instrumental systematics, 7 imaging spectroscopic analysis, 8 and variable selection for calibration. 9 A comparison research also indicated that SVMs outperformed PLS on some validation tests. 10 In this article, least squares support vector machines (LS-SVMs) and GPR are further studied. Their performances on a NIR spectroscopic calibration are compared to the traditional linear regression method, PLSR, on several aspects, including global error, local prediction behavior, and learning efficiency.
Theory
All the models mentioned here are based on learning a prediction rule on an observed data set, which is also called calibration set. However, these models have different learning and prediction strategies. They can be divided into two categories according to the way they make predictions: one, called variable space-based prediction, calculates the correlation coefficients between each of the variables and the target analyte; the other, called sample space-based prediction, ignores individual variable but focuses on affinity and dissimilarity between the samples. PLSR is the first type and the non-linear methods investigated here, LS-SVMs and GPR, are the second type.
Partial least squares regression
PLSR is a predictive two-block regression method based on estimated latent variables, initially developed by Wold et al.
11
and first applied to NIR data by Martens and Jensen.
12
The purpose of PLSR is to predict the property of interest y from observed NIR spectra
The residual on
Correspondingly, the PLS score
Loading vectors
Finally, the regressors described in equation (1) can be defined by
Least squares support vector machines
PLSR is normally considered as one of the most powerful high-dimensional linear regression methods. However, the performance of PLSR is sometimes limited due to a non-linear relationship between the input variables and the response. In order to extend the regression method to a non-linear framework, new variables representing non-linearity need to be introduced. This can be achieved by mapping the input data into a higher dimensional feature space through a transformation
However, this problem is not solvable due to potentially infinite dimensionality. Instead we construct the Lagrange dual function
14

Substituting
In the following experiment only the radial basis function (RBF) kernel is considered, formulated as
The prediction for a new observation
Substituting
Notice that only two free parameters
Gaussian process regression
A Gaussian process (GP) is a collection of random variables such that any finite subset exhibits a joint Gaussian distribution.
16
First consider that an observation yi in the calibration set
Assume this Gaussian white noise has zero mean and precision of γ, then the probability distribution of the observations given the latent function can be described by a Gaussian likelihood function
There are many other possible likelihood functions for complicated relationship between latent function and observations, depending on the type of the noise, but in the following study only Gaussian likelihood is considered. The latent function described above is the target GP. Similar to mean and variance in a Gaussian distribution, a GP is fully defined by its mean function
Normally, for notational and computational convenience, the mean function is set to
Multiplying equation (22) with the likelihood function in equation (19), and integrating out
Similarly to the other prediction models, the main interest is making predictions on new measurements based on the information from a training (calibration) data set
The three free parameters
For prediction of a new observation
Taking into account the Gaussian noise
The conditional probability
Compared with LS-SVMs, GPR not only gives a prediction mean for the new observation, but also provides a full probabilistic posterior distribution. This additional information is sometimes very useful, for example for outlier detection. However, since interpreting variance on predictions requires one more degree of freedom, it also increases the difficulty of tuning the hyper-parameters, especially when the training set is a small one.
Experiment
Three high-dimensional regression models (PLSR, LS-SVMs and GPR) were applied to the same NIR spectral data set. Their performances in prediction were presented and compared. All of the calculations were performed in Matlab R2014b (The MathWorks Inc, MA). PLSR was achieved with the Statistics and Machine Learning Toolbox; LS-SVM was realized with LS-SVMlab package; 17 and GPR was calculated with GPML package. 18
Sample composition
The data set consists of NIR spectra and corresponding target constituent concentration (nitrogen) from 1240 agricultural seeds. Images were recorded using a mercury–cadmium–telluride hyper-spectral camera and then post processing was used to average the spectral points over the seeds to produce a single spectrum per seed. For each spectrum there are 239 valid wavelengths in the NIR range, spanning from 993.0 nm to 2488.4 nm. The constituent content was then measured using a combustion-based chemical analysis.
Preprocessing
Several preprocessing methods were evaluated by cross-validation using the PLSR model. The combination of SNV + Savitzky-Golay derivative was implemented. Raw spectra were first preprocessed by standard normal variate (SNV), to remove constant offset and scatter effect by centering and rescaling individual spectrum, and then transformed with Savitzky-Golay 2 side points, second polynomial order fitting first derivative.
Randomization
The 1240 spectra were first randomly divided into two groups: group A (with 360 spectra) as calibration set and group B (with 880 spectra) as validation set. Figure 1 shows the density distribution, for nitrogen of one pair of randomized calibration and validation sets. All of the three regression methods were trained on the same calibration set first. Obtained models were then applied to predict nitrogen concentration in the validation set according to their spectra, and then compared to their true responses. This randomized test was performed five times in total. In each single test, the validation set was carefully kept away from optimizing the model, so error on the validation set can be seen as a good indicator of generalized prediction performance.
Population distribution for nitrogen in the calibration set and validation set for one random split.
The three regression models were trained on calibration set as follows.
Partial least squares regression
As described in ‘Partial least squares regression’ section, there is only one free parameter in the PLSR model: the number of PLS factors used for prediction. Although higher order factors contain more detailed features from the variance of regressors, this is not necessarily correlated with the response (nitrogen concentration). Using higher order components will inevitably lead to a more complicated model, which may generalize less well. Cross-validation is very useful for choosing a reasonable highest order of PLS factor. An internal 10-fold cross-validation was performed on the PLSR model with different numbers of factors. Mean square error of cross-validation (MSECV) was taken as an indicator of the quality of the tested model.
Figure 2 shows RMSECV values for one randomized calibration set. This parameter selection process was separate from the test set, and was solely used for choosing the number of PLS factors. According to the result, cross-validation suggests using a PLSR model with 11 components. Notice in Figure 2 that 11 and 12 components had very close MSECV values (0.035% and 0.034% respectively) and 11 was adopted, because when two PLSR models have comparable performances, the simpler one is preferred.
Mean square error of cross-validation (MSECV) (% nitrogen) for partial least squares regression (PLSR) model when using different number of components.
Least squares support vector machines
For the non-linear regression model LS-SVMs, there are two free hyper-parameters: γ, related to the strength of regularization term, and l, determining the length scale of the adopted RBF kernel. Both of these free parameters need to be tuned through the cross-validation process. Initial values of γ and l were decided by coupled-simulated annealing (CSA), a global optimization method composed of several distributed simulated annealing processes with coupled acceptance probability,
19
to avoid very bad local minima. The two parameters were then tuned to minimize the squared error loss function
Gaussian process regression
A GP is fully defined by a mean function, covariance function and a likelihood function. The options for these three functions in the study are described as follows:
Mean function: In order to simplify the computational work, before GPR was carried out all the response was mean centered to 0 by taking out the offset. As a result, the mean function was set to
Covariance function: RBF (with magnitude) was used as the covariance function in GPR, as described in equation (21). There are two hyper-parameters in this covariance function: isotropic length scale l and signal magnitude
Likelihood function: Assuming noise on observations has a Gaussian distribution, the Gaussian likelihood function was adopted here. Noise magnitude was specified by
In total, there are three free parameters:
Results
Comparing global RMSEV
As discussed in the previous section, the 1240 data points were randomly divided into two sets: calibration set with 360 samples and validation set with 880 samples. The calibration set and validation set were fully randomized and tested five times for each model. Since the predictions from all the models at each test were correlated because the validation set was a common one, errors in the laboratory measurements for the 880 samples contributed to all sets of prediction errors. 20 T test for paired samples can be utilized to calculate the true differences on biases and true ratio of root mean square error for validation (RMSEV).
RMSEV and biases (%) for PLSR, LS-SVMs and GPR on each randomized validation set.
GPR: Gaussian process regression; LS-SVMs: least squares support vector machines; PLSR: partial least squares regression; RMSEV: root mean square error for validation.
The 95% confidence intervals for the true difference in biases (% nitrogen).
GPR: Gaussian process regression; LS-SVMs: least squares support vector machines; PLS: partial least square.
The 95% confidence intervals for the true ratio of RMSEV (% nitrogen).
GPR: Gaussian process regression; LS-SVMs: least squares support vector machines; PLS: partial least square; RMSEV: root mean square error for validation.
Several important conclusions can be drawn from above results:
For all the randomization tests, there are steady and significant differences on the RMSEV between PLS/LS-SVMs and PLS/GPR. The LS-SVMs and GPR always out-performed PLSR in the sense of RMSEV. Averaged ratios of RMSEV were: PLSR/LS-SVMs = 1.270; PLSR/GPR = 1.300. Randomized test 3 showed that the RMSEV and bias of LS-SVMs are significantly larger than GPR, but both the magnitudes of differences are very small. Other tests show no significant differences on RMSEV and bias. These results indicate that the two non-linear models are equivalent on predicting target response. Most of the randomized tests showed no significant difference in biases between PLS, LS-SVMs and GPR; this is not a surprise since all the models were expected to be globally unbiased.
Local error behavior
The non-linear models performed better than the linear model in the sense of global error. In this section, predictive behaviors for the three models on each individual sample in the validation set are reported to help understand how linear and non-linear models differ over the whole range. One good way to visualize local error behavior is to plot predictions against their true observations on the whole validation set, as shown in Figure 3.
Predicted vs. observed for PLSR Predicted vs. observed for LS-SVMs Predicted vs. observed for GPR. Predictions on each individual sample in the validation set are plotted against their true observations for partial least squares regression (PLSR) (a), least squares support vector machines (LS-SVMs) (b) and Gaussian process regression (GPR) (c), with a linear and a quadratic fit to each of them.

For PLSR, even though the performance was acceptable in the middle part of range (roughly 1.5–2.5%), predictions were heavily biased in the two tails from the regression line. There are two reasonable explanations:
The investigated constituent (nitrogen) concentration had an approximately linear impact on NIR spectra within a small range near the population mean, but non-linear effects become non-ignorable outside this linear range. Prediction power for PLSR was limited. In order to minimize global error, PLSR will try to give best prediction in the center part, which accounts for the majority of the population. As a result, within this range linear correlation between observations and predictions was well maintained. The extreme samples are predicted less well, though this has a limited impact on the overall squared error cost function because there are far fewer of them (see Figure 1).
In contrast, the non-linear models (GPR for example here) had fairly consistent standard deviation from the regression line across the range. Non-linear biases at two tails were removed and predictions were then almost linearly related to the observations for all the samples in the validation set. The slope of regression line was also improved from 0.84 to 0.93 by using GPR. Considering any inverse calibration method implicitly uses population distribution in the training set as a prior, all the predictions are naturally shifted to the sample mean, 21 in order to minimize global error. For non-linear models, since the fit was much better, this shrinkage to the mean was much less pronounced.
In order to quantitatively compare predictive performance of PLS, LS-SVMs, GPR on the low and high constituent ranges, predictions on the first 5% and the last 5% of the samples in the test set were calculated separately, ranked by their nitrogen concentration. Again, since all the comparisons were carried on a common validation set for each test, the same methods were used to see whether the differences on RMSEV and bias were significant, same as presented in ‘Comparing global RMSEV’ section. Detailed results on PLSR and GPR are shown in Table 4.
It can be seen, unsurprisingly, that GPR was significantly better than PLS everywhere across the range, in the sense of RMSEV. Especially, the ratio of RMSEV was further enlarged in the two tails. There was no significant difference on the biases on the whole range, and both were very close to 0, because both the models are based on unbiased decision rules. However, there were significant differences on biases on low and high concentration range, and PLSR was, surprisingly, less biased on the first 5% of the samples. This is explained in Figure 4. Comparison of PLSR and GPR on different % nitrogen ranges.
a
CI: confidence interval; GPR: Gaussian process regression; PLSR: partial least squares regression; RMSEV: root mean square error for validation. Last row presents 95% confidence interval for the true difference of biases and true ratio of RMSEVs. Partial least squares regression (PLSR) predictions vs. observations on low constituent range. Red: linear fitting; Green: quadratic fitting; Black: 1:1 line (y = x).

The red line is the regression line of prediction on observed data set. The y = x black line shows the shrinkage of the mean that occurs with PLSR. Because this shrinkage is in the same direction on the curvature of this end of the range, it actually reduces the bias of PLSR. In contrast, at the high end of the range, the shrinkage and curvature are in opposite directions, and PLSR has a very high bias compared to GPR.
Varying training set size
All the above analyses are conditional on a fixed size training set. A very important question is how fast each model learns with a growing training set. In practice, the reference measurement could be very expensive and time consuming. Sometimes there will not be sufficient training samples. Then it becomes desirable to understand how these different models perform with varying training set size. In Figure 5, global error on the validation set (RMSEV) is plotted against the number of samples in the training set. For each fixed size of training set, RMSEV is averaged over five randomized groupings of calibration and validation sets.
RMSEV for three models with varying training set size. partial least squares regression (PLSR): cross-validations were performed to choose the number of factors for each test; Gaussian process regression (GPR) and least squares support vector machines (LS-SVMs): RBF kernel.
It can be observed that global errors for all the three models decreased when the training set size increased, and then gradually converged to their limits. However, they exhibited different learning speeds. LS-SVMs and PLSR had similar trends, except for a roughly constant offset on RMSEV between the two models. For GPR, when the training set size was small, the prediction power was extremely poor (a RMSEV of 0.38% is almost the width of population distribution in the validation set, so the GPR model gave almost homogeneous predictions despite the variation in the spectra), but the predicting power grew quickly with an increase in training set size, and soon became non-distinguishable from LS-SVMs.
This is the first time in this study when GPR and LS-SVMs exhibited significant difference in their predictive performance. Inevitably one wishes to ask a question: what are the differences between LS-SVMs and GPR? By comparing equation (17) and equation (27), it can be seen that predictions on a new measurement were effectively the same. The covariance function used in GPR was In LS-SVMs, the goal is to minimize the squared error loss function, whereas GPR tries to maximize posterior probability. They are quite different optimization targets. Imagine that one set of hyper-parameters gives correct predictions everywhere in the validation set, but quite large variance on them, then it is a perfect predictor for LS-SVMs because it has 0 squared error loss, but a poor predictor for GPR because posterior probability is low. Posterior probability is not a direct indicator of generalization performance, especially when one only cares about predictive mean. In this sense posterior probability might not be suitable to monitor the quality of the model, especially when training set is a small one, because in this case, there is not enough information to estimate the full probability distribution. Squared error loss function depends only on the posterior mean, so it concentrates more on giving close predictions, which helps to generalize better when the available evidence is weak. However, if probabilistic information is wanted, then one needs a posterior probability, which is also one key advantage of GPR. LS-SVMs use 10-fold cross-validation to tune the parameters, but GPR as implemented here uses evidence maximization (or marginal likelihood maximization). Notice that one can also easily set Leave one out cross validation (LOO-CV) as inference method in GPR, but these two methods as used here have fundamental differences, which make them distinguishable in the final result. Marginal likelihood involves the probability of the observations given the assumptions of the model, whereas LOO-CV assesses the point prediction only. As a result, LOO-CV is more robust against model misspecification.
22
Experimental results also show that when using LOO-CV, GPR generalizes slightly better in investigated data set, see Table 5. RMSEV of GPR with LOO-CV and evidence maximization for five different randomized tests.
a
GPR: Gaussian process regression; RMSEV: root mean square error for validation. Training set size = 60.
It seems that LOO-CV is strongly preferable when the training set is small. When data provided is insufficient, LOO-CV conditions more on the observation and hence uses less knowledge from the prior, which might be mis-specified. Notice that there is no guarantee that cross-validation is always better than evidence maximization in tuning the parameter: since cross-validation conditions too much on observations, there is a higher risk of over-fitting. Since GPR implemented here use both probabilistic loss function and evidence maximization as inference method, unsurprisingly it has relatively worse performance when the training set is a small one. On the other hand, there was no parameter initialization in GPR modeling (where in the LS-SVMs modeling CSA was employed to find suitable start values on hyper-parameters), which makes it more vulnerable to bad local minima for small training set cases. However, this could be an advantage when training set size is large, because it is more computationally efficient.
Conclusion
Three models, PLSR, LS-SVMs, and GPR, were introduced and studied on a large NIR spectroscopic data set. The averaged ratio of PLS/LS-SVMs and PLS/GPR on RMSEV were 1.270 and 1.300 correspondingly. The two non-linear models had similar performances and both improved significantly on PLSR. There was no strong evidence to indicate any significant differences in global bias between the three models. In PLSR, fitting power was not adequate to model the genuine non-linear relationship between NIR and target analyte, which led to a large bias and error when predicting samples with extremely high concentration. Non-linear models including LS-SVMs and GPR can effectively correct the non-linear deviation for extreme samples. Prediction accuracy for all of three models grows with an increasing training set. LS-SVM is strictly better than PLSR, independent of the size of calibration set. GPR has poor prediction performance when the training set is small, due to the characteristic of the evidence maximization process. However, the performance improves quickly when more samples are included in the calibration process, and soon becomes non-distinguishable from LS-SVMs.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) received no financial support for the research, authorship, and/or publication of this article.
