PNA
¹H qNMR and Chemometrics of Heirloom Apple Juices and Ciders · PNA-WP-CIDER v3.0

11. Chemometrics: Choice of Pre-processing

11.1 Design of the comparison

A multivariate model sees only the table of numbers that is handed to it, and the way in which a spectrum is turned into that table usually matters more than the algorithm applied afterward.191,214,236,237 The alternatives listed in Section 5.9 were therefore compared before any model was interpreted: five representations of the spectrum, three normalizations and four treatments of the variables after mean-centering, for the native and the freeze-dried tubes separately. The representations differ greatly in size. The freeze-dried spectra give 187 uniform bins of 0.04 ppm, 746 bins of 0.01 ppm, 187 optimized buckets, 27 targeted integrals and 17 fitted concentrations; the native spectra give 187, 746, 187, 30 and 15.

Three criteria were applied, each of which corresponds to a use of the data. The first asks whether similar samples are close to one another. The Stormalong cans and the cans of Downeast Original Blend provide groups of samples that are known to be the same product; for each of them the nearest neighbor in the pre-processed data was determined, and the fraction for which this neighbor is another lot of the same product was recorded as the lot retrieval rate (14 such samples with a freeze-dried tube, 18 with a native tube). The second criterion is the balanced accuracy of two classifiers, PLS discriminant analysis and a support vector machine, averaged over five labels (dryness, dominant acid, presence of sucrose, market segment and declared adjunct) in cross-validation grouped by producer. The third is the median Q² of PLS regression models for 14 (freeze-dried) or 13 (native) constituents. The results are assembled in Figure 38.

Comparison of pre-processing options
Figure 38. Comparison of pre-processing options. (a) Freeze-dried tube and (b) native tube, with intensities on the absolute scale of the internal standard: lot retrieval rate, mean balanced accuracy of two classifiers over five labels, and median Q² of PLS regression, for five representations of the spectrum (rows) and four treatments after mean-centering (columns). (c) Median Q² of PLS regression on optimized buckets (Pareto scaling) for three normalizations. (d) Effect of mean-centering on PLS regression: cross-validated error relative to the best model, median over ten constituents, against the number of latent variables. (e) Effect of mean-centering on PCA: share of the total sum of squares carried by each component.

11.2 Normalization

The decisive factor for quantitative work is the normalization. With intensities on the absolute scale provided by the internal standard, the median Q² of the PLS models on optimized buckets is 0.98 for the freeze-dried and 0.99 for the native tube. Normalization to total area lowers it to 0.61 and 0.59, and probabilistic quotient normalization to 0.60 and 0.63 (Figure 38c). The reason is simple. Both normalizations were devised for samples of unknown dilution, such as urine, in which only relative composition has a meaning.190,214 A cider is not diluted to an unknown degree. Its total signal is dominated by ethanol in the native tube and by sugar in the freeze-dried tube, and dividing by it removes exactly the information that a quantitative model needs, while it couples every other variable to the dominant constituent. For classification and for the retrieval of lots the normalization makes no consistent difference. Since the absolute scale is available at no cost, it was retained for all further work.

11.3 Mean-centering and scaling

Mean-centering is not a matter of choice for the methods used here, although its omission is not always visible. Without centering, the first principal component is the mean spectrum: it carries 84 % of the total sum of squares and is collinear with the mean (cosine 0.995), whereas after centering the first component carries 61 % of the variance and describes the differences between ciders (Figure 38e). A PLS model built on uncentered data must likewise spend its first latent variable on the mean, and its error is higher at every model size up to the point where enough latent variables are available to absorb the difference; with one latent variable the cross-validated error is 7.6 times that of the best model against 6.2 times for the centered model (Figure 38d). Methods based on distances are unaffected, since a common offset does not change a distance, and the usual software implementations of PCA and PLS center the data internally whether asked to or not.215 All data were mean-centered, with the mean taken from the training samples only.

The scaling that follows centering determines how much weight a small signal receives. Without scaling, the buckets of the sugars and of ethanol account for nearly all of the variance, and the similarity of two ciders is judged by their sugar content alone: the lot retrieval rate is only 0.57 for the freeze-dried and 0.39 for the native tube. Scaling to unit variance gives every bucket the same weight and raises the retrieval rate to 0.86 and 0.61, but it also gives full weight to buckets that contain nothing but baseline, and the median Q² of the regression falls to 0.87 in the freeze-dried tube. Pareto scaling, in which each variable is divided by the square root of its standard deviation, lies between the two: retrieval rates of 0.79 and 0.56 with a median Q² of 0.98 and 0.99. The logarithmic transformation behaves erratically. It helps where the label is defined by a threshold on a minor constituent and it harms the retrieval of lots in the native tube (0.28), because it magnifies the noise of empty buckets. Pareto scaling was adopted as the only option that is among the best by every criterion.

11.4 Representation of the spectrum

The representation proved to matter least. Uniform bins of 0.04 ppm and optimized buckets of the same nominal width give retrieval rates, balanced accuracies and Q² values that agree within the second decimal place in both tubes, and bins of 0.01 ppm, with four times as many variables, bring no gain that could be distinguished from chance. The advantage claimed for optimized bucketing, that a peak is not divided between two variables when its position shifts, has little to act on in these data, because all spectra had been referenced individually and placed on a common axis beforehand. Optimized buckets were nevertheless adopted, on the principle that a variable should correspond to a signal, with the plain statement that the present data would have supported uniform bins equally well.

The two targeted representations deserve a separate comment. The table of 27 to 30 integrals performs as well as the full bucket table by all three criteria, and the table of fitted concentrations, with fewer than twenty variables, gives the highest lot retrieval rate in the native tube (0.78 after scaling to unit variance) because fitting has removed baseline and noise. For a matrix as well understood as cider, the targeted table contains essentially all of the information that the untargeted one contains. What the untargeted buckets add is independence from the assignment: they register a compound that nobody has looked for, and they do not require the fitting procedure of Section 5.6. The following sections use the optimized buckets, on the absolute scale, mean-centered and Pareto-scaled, and report the concentration table alongside where the comparison is instructive.

The limits of this comparison should be stated. The differences among the three bucket tables, and most differences between scalings in the classification criterion, amount to one or two hundredths of balanced accuracy or to one lot in fourteen. With fewer than one hundred samples such differences are within the variation between cross-validation splits. Only three effects are large enough to be regarded as established: the loss of quantitative information on normalization to total area, the damage done to regression on bucket tables by scaling to unit variance, and the poor retrieval of similar samples from unscaled data.