← Back to Blogs & Publications Spectroscopic wavelength selection algorithm display

Wavelength Selection & Feature Engineering for NIR Spectral Models

Why restricting a near-infrared calibration to selected wavelengths or intervals can make it more accurate and easier to interpret, how the main selection methods work, and why the selection itself has to be validated — based on the original method papers and published reviews.

Too many wavelengths, too few samples

A near-infrared spectrum is recorded at hundreds of equally spaced wavelengths, while the number of reference samples available for calibration in the food and feed and process industries is usually far smaller. Zou Xiaobo et al. note in their review that this large number of spectral variables often makes the prediction of a dependent variable unreliable, and that considerable effort has gone into methods that identify the variables carrying useful information or eliminate those containing mostly noise [1]. Partial least squares (PLS) regression copes with many correlated variables, but regions dominated by noise or by unrelated absorbers still enter the model. Removing them can improve predictive ability and makes it easier to see which parts of the spectrum the model relies on, but the selection step also introduces new ways to overfit, which is why Andersen and Bro place the emphasis of their tutorial on how to use variable selection in practice and avoid the most common pitfalls [2].

Interval methods: iPLS

Interval PLS (iPLS), introduced by Nørgaard et al., divides the spectrum into intervals, builds a local PLS model on each one and compares the local models with the full-spectrum model in a graphical display [3]. On a NIR data set of 60 beer samples correlated to original extract concentration, the best iPLS model reduced the prediction error of the full-spectrum model by a factor of four, and the authors stressed that the graphical output helped to interpret the chemical system behind the model [3]. Because iPLS keeps contiguous blocks of wavelengths rather than isolated points, the selected region follows the shape of absorption bands; in the same study the chosen intervals covered the variables found by forward stepwise selection and by two other selection methods [3].

Search and ranking methods

Several other families of methods are in common use; the reviews by Zou Xiaobo et al. and by Andersen and Bro describe them in more detail [1][2].

  • In genetic algorithms (GA-PLS), candidate wavelength subsets are encoded as binary strings and evolved by selection, crossover and mutation, with a cross-validated PLS error as the fitness criterion. Leardi showed that, after suitable modifications, the variables selected by GA-PLS often form well-defined spectral regions rather than single variables scattered across the spectrum, giving models with better predictive ability than the full spectrum [4].
  • For uninformative variable elimination (UVE), Centner et al. add artificial noise variables to the data and eliminate every experimental variable that is not more important than the noise variables, judged from the PLS regression coefficients [5].
  • In competitive adaptive reweighted sampling (CARS), Li et al. rank wavelengths by the absolute value of their PLS regression coefficients over repeated Monte Carlo sub-sampling runs, shrink the variable set step by step and keep the subset with the lowest cross-validation error [6].
  • Variable importance in projection (VIP) is a score summarising each variable’s contribution to a PLS model. Chong and Jun compared PLS with VIP against the lasso and stepwise regression in simulations with correlated predictors and discussed how the VIP cut-off should be chosen [7].
  • With jackknife significance testing, Westad and Martens test the significance of each regression coefficient using the cross-validation sub-models and keep only significant variables; on NIR spectra of beer the method performed as well as or better than the other selection methods tested and was robust to the cross-validation scheme [8].

The risk of over-selection

Every selection method searches among a very large number of possible subsets, and the more subsets are compared, the more likely it is that one of them fits the calibration data by chance. Jouan-Rimbaud et al. tested this by adding random variables to NIR data and found that a genetic algorithm could still select irrelevant variables despite a careful validation procedure; applying forward selection to the GA subsets reduced the effect [9]. The practical consequence is that the error used to choose the variables is not an honest estimate of future performance. Fernández Pierna et al. therefore used the root-mean-square error of prediction on an independent test set as the criterion for their backward selection method, and reported that the selected models improved on, or at least kept, the prediction performance of full-spectrum PLS while using fewer variables [10]. Three precautions follow from this literature [2][9][10].

The first is to keep a test set outside the selection loop: samples used to choose wavelengths or intervals must not also be used to judge the final model. The second is to compare against the full-spectrum model, since selection is worth keeping only if it improves prediction on independent samples, or matches it with a simpler and more interpretable model. The third is to check the chemistry. Selected regions that cannot be linked to absorption bands of the analyte or of the matrix deserve suspicion, especially when the calibration set is small.

Testing a restricted range against the full spectrum

In the caliX suite, the PLS regression, spectral pre-processing and model validation tools are used to compare a restricted wavelength range with the full-spectrum model on samples that were not used to make the choice, as the literature above recommends [2][10]. Whether a restricted range is justified for a given product and analyzer is decided by the validation results rather than by the selection method alone, and is established by running both models on your own samples against reference analyses, in a feasibility study that follows ISO 12099 [11].

References

  • [1] Xiaobo, Z., Jiewen, Z., Povey, M.J.W., Holmes, M., Hanpin, M. (2010). Variables selection methods in near-infrared spectroscopy. Analytica Chimica Acta, 667(1–2), 14–32. doi:10.1016/j.aca.2010.03.048
  • [2] Andersen, C.M., Bro, R. (2010). Variable selection in regression — a tutorial. Journal of Chemometrics, 24(11–12), 728–737. doi:10.1002/cem.1360
  • [3] Nørgaard, L., Saudland, A., Wagner, J., Nielsen, J.P., Munck, L., Engelsen, S.B. (2000). Interval Partial Least-Squares Regression (iPLS): A Comparative Chemometric Study with an Example from Near-Infrared Spectroscopy. Applied Spectroscopy, 54(3), 413–419. doi:10.1366/0003702001949500
  • [4] Leardi, R. (2000). Application of genetic algorithm–PLS for feature selection in spectral data sets. Journal of Chemometrics, 14(5–6), 643–655. doi:10.1002/1099-128X(200009/12)14:5/6<643::AID-CEM621>3.0.CO;2-E
  • [5] Centner, V., Massart, D.L., de Noord, O.E., de Jong, S., Vandeginste, B.M., Sterna, C. (1996). Elimination of Uninformative Variables for Multivariate Calibration. Analytical Chemistry, 68(21), 3851–3858. doi:10.1021/ac960321m
  • [6] Li, H., Liang, Y., Xu, Q., Cao, D. (2009). Key wavelengths screening using competitive adaptive reweighted sampling method for multivariate calibration. Analytica Chimica Acta, 648(1), 77–84. doi:10.1016/j.aca.2009.06.046
  • [7] Chong, I.-G., Jun, C.-H. (2005). Performance of some variable selection methods when multicollinearity is present. Chemometrics and Intelligent Laboratory Systems, 78(1–2), 103–112. doi:10.1016/j.chemolab.2004.12.011
  • [8] Westad, F., Martens, H. (2000). Variable Selection in near Infrared Spectroscopy Based on Significance Testing in Partial Least Squares Regression. Journal of Near Infrared Spectroscopy, 8(2), 117–124. doi:10.1255/jnirs.271
  • [9] Jouan-Rimbaud, D., Massart, D.L., de Noord, O.E. (1996). Random correlation in variable selection for multivariate calibration with a genetic algorithm. Chemometrics and Intelligent Laboratory Systems, 35(2), 213–220. doi:10.1016/S0169-7439(96)00062-7
  • [10] Fernández Pierna, J.A., Abbas, O., Baeten, V., Dardenne, P. (2009). A Backward Variable Selection method for PLS regression (BVSPLS). Analytica Chimica Acta, 642(1–2), 89–93. doi:10.1016/j.aca.2008.12.002
  • [11] ISO 12099:2017. Animal feeding stuffs, cereals and milled cereal products — Guidelines for the application of near infrared spectrometry. ISO, Geneva. iso.org/standard/67352.html
USTECH Innovations Logo

Discuss this application for your process

Our application team can walk through the method, share the supporting literature and discuss how it applies to your process.

Contact Us

Read Next

Understanding Savitzky-Golay Filtering in Preprocessing
GUIDE

Understanding Savitzky-Golay Filtering in Preprocessing

What the Savitzky-Golay filter actually does to a spectrum, why derivatives remove baselines, and how window length and polynomial order should be chosen, with the original and follow-up literature.

Read Guide
Introduction to PLS Regression in caliX Suite
GUIDE

Introduction to PLS Regression in caliX Suite

A practitioner's walk through a PLS calibration: how the data are split, how the pre-processing and the number of latent variables are chosen by validation, which diagnostics to read, and how the model is kept alive in production.

Read Guide