Stress-Testing Chemical Origin Classifiers with Lessons from Pitch-Error Analysis

Speech researchers learned, often the hard way, that a system is only as good as the pitch estimate it is built on. Pitch, or fundamental frequency, is the rate at which the vocal folds vibrate. When a pitch tracker makes an error, the damage spreads through every later processing stage. That field also learned to measure the damage properly. It separates small "fine" errors from large "gross" errors, such as reporting double or half the true pitch. It injects these errors on purpose, and it compares systems against an oracle that is given the true pitch.

Chemical provenance studies try to tell where a plant or mushroom came from by reading its chemical fingerprint, typically a chromatogram (a trace of compounds separated by how long they take to pass through a column). These studies report very high accuracies, but they rarely audit them in this way. Their equivalent of the upstream estimate is the retention time: when each peak appears. It drifts with column aging and temperature, and peaks can be assigned to the wrong compound.

We propose to bring the pitch community's error methodology into chemometrics. We will build an error-injection and oracle protocol that measures how much of a provenance classifier's accuracy survives realistic fine and gross retention errors. We will also test whether the drift is entangled with the origin labels themselves. Finally, we will test whether a robust least-absolute-error alignment, borrowed from noise-robust pitch stylization, recovers more of the oracle performance than current Gaussian-based alignment, simple shift augmentation, or peak-table integration.

The stakes are concrete. Published origin classifiers report over 99% accuracy with low-level data fusion and OPLS-DA (orthogonal partial least-squares discriminant analysis, a linear projection classifier) on Gentiana rigescens HPLC fingerprints (Assessing Geographical Origin of Gentiana Rigescens…). They report 94.01% for a 2D convolutional network on folded laser-induced breakdown spectra (LIBS with Spectral Matrix and CNN). Neither number tells a regulator how the model behaves when next year's column has drifted. Neither tells us whether the "marker compounds" the model highlights are real chemistry or artifacts of misaligned peaks.

Core Claim

Retention-time error in untargeted chemical fingerprinting behaves like pitch error in speech. Fine drift and gross peak misassignment damage downstream origin classifiers in different ways. Smoothing and least-squares corrections fail mainly on the gross errors, which is what Noise Robust Pitch Stylization Using MAE showed for octave errors and Sujith et al. showed for heuristic smoothing. We predict three things.

First, reported provenance accuracies will degrade sharply and non-linearly under gross misassignment, while staying fairly flat under fine drift. Second, the sets of discriminating markers will be less stable than the accuracy numbers suggest. Third, an alignment step that minimizes absolute rather than squared error will close more of the gap to an oracle-aligned peak table than the Gaussian mixture point registration used by BARCHAN.

The new part is not the robust loss on its own. It is the full transfer of the pitch community's evaluation method into this field: the fine/gross error taxonomy, deliberate error injection, oracle bounds and confound tests. Nothing in the chemometrics literature we found applies this method. The literature search found zero papers connecting the two fields.

How the Pitch Literature Shapes the Design

Three speech results motivate the design.

Coy and Barker ran oracle-pitch experiments. Supplying true pitch closed most of the gap in competing-speaker separation. This is the template for our oracle condition.

PGSS uses pitch to guide speech separation. Its authors concede that their downstream performance is bounded by the pitch tracker. This is the kind of upstream bound we want to measure for chemistry.

Strömbergsson traced much of the error in widely used pitch trackers such as YIN to voicing decisions rather than frequency precision. The lesson is that one aggregate error number hides which failure mode matters. That is why we separate error types.

The method itself comes from the MAE stylization paper. It fits piecewise polynomials to a pitch contour, choosing segment boundaries by dynamic programming. Using absolute error instead of squared error reduced RMSE by up to 6.49 Hz at 0 dB signal-to-noise ratio, across four pitch trackers. The benefit grew as noise increased.

On the chemistry side, BARCHAN supplies the strongest existing aligner. It extracts peak "blobs" from two-dimensional gas chromatograms and registers them with Coherent Point Drift, a Gaussian mixture method. It applies a rigid transform on the second axis and a non-rigid transform on the first. It also admits that thin blobs, such as n-paraffins, remain slightly misaligned. We treat that admission as the place where a robust loss might help.

The provenance papers motivate the work rather than constrain it. They establish that multi-compound fingerprints are needed: Yong et al. show single markers fail for Podocarpus nagi. They also show that sample sizes are small, for example six regions with three fruiting bodies each for Tricholoma matsutake (GC×GC-TOF MS of T. matsutake). Small cohorts make spurious markers likely.

Research Program

The first component is an error model. For a sample, let the observed retention time of the peak truly at time $t$ be

$$t' = t + \delta(t) + g(t),$$

where $\delta(t)$ is a smooth, monotone drift and $g(t)$ is a sparse term. Most of the time $g(t)$ is zero. With a small probability $p$, it moves a peak onto the slot of a neighboring compound, which is the chromatographic analogue of an octave jump. We will fit the size of $\delta$ to replicate runs where these exist, and to the residual shifts BARCHAN reports on its gas-oil data. Synthetic drift will then sit in a realistic range rather than an arbitrary one.

The second component is the audit. We take a published-style pipeline: OPLS-DA on fused HPLC fingerprints, a random forest, and 1D and 2D CNNs on spectra. We train it on cleanly aligned data and then evaluate it on test data corrupted by fine drift alone, gross misassignment alone, and both. We report accuracy and Matthews correlation coefficient (MCC). We also report marker stability: the overlap between the top-20 variable-importance features selected on clean data and those selected on corrupted data.

The audit includes a confound test. If origin labels line up with run order or batch, we retrain with batch-held-out splits to see how much accuracy depended on instrument state. For folded LIBS spectra, we additionally test whether shifting the spectrum by one channel moves features across row boundaries of the folded matrix. If it does, the 2D CNN could become more fragile than the 1D CNN, which is the tension the folding raises.

The third component is the robust aligner. We estimate the warp $w$ that maps a sample's peak list $\{t'_i\}$ onto a reference peak list $\{r_j\}$ by solving

$$\min_{w \in \mathcal{W}_K} \sum_i \min_j \lvert w(t'_i) - r_j \rvert,$$

where $\mathcal{W}_K$ is the set of monotone piecewise-linear warps with at most $K$ segments. The problem is solved by the same combination of dynamic programming over segment boundaries and linear programming within segments used in the MAE stylization paper. The inner minimum, which matches each peak to its nearest reference peak, is updated by alternating minimization.

Two design rules carry over from the Gaussian aligner. Because BARCHAN found that a hybrid transform works best, we apply the warp only on the first retention axis and use a rigid offset on the second. We also include a Huber-loss variant of Coherent Point Drift as an intermediate robust baseline, so that we can tell whether the gain comes from the loss or from the dynamic-programming structure.

As a fidelity check on the transfer, we first reproduce the MAE-versus-MSE gap on the KEELE and Paul Bagshaw pitch corpora corrupted with NOISEX-92 noise. This confirms our implementation of the stylization machinery before we move it to chromatograms.

Baselines

The naive reference is no alignment at all: classifiers trained and tested on raw fingerprints under each injected error condition. This gives the floor of the degradation curves.

The oracle is the upper bound. It is the classifier trained and tested on a peak table built from true peak identities, which are known by construction in the injected setting. The gap between the naive floor and the oracle is the quantity every method is scored against. We report the fraction of that gap recovered, the measure used in pitch oracle studies such as Coy and Barker.

The strongest existing aligner is BARCHAN. We run it with its published hybrid transform on the same peak lists, the same reference chromatogram and the same tuning budget as our aligner: a grid over its kernel width and regularization equal in size to our grid over $K$. On its own gas-oil benchmark, BARCHAN reports a correlation coefficient of 0.93 and a structural similarity (SSIM) of 0.94 on Dataset 1, and 0.83 and 0.94 on Dataset 2. Beating it means two things. On the gas-oil data, our aligner must exceed 0.83 CC on Dataset 2 without losing SSIM, specifically on the thin-blob regions BARCHAN flags. On injected HPLC data, it must recover a significantly larger fraction of the oracle gap at gross-error rates $p \geq 0.05$, with significance assessed by paired bootstrap over test samples.

The classifier baselines are the published configurations. For OPLS-DA with low-level fusion, the cited paper reports accuracy above 99% and MCC between 0.95 and 1.00 on clean G. rigescens HPLC data (Assessing Geographical Origin…). For CNNs on LIBS, the reported accuracies are 94.01% for the 2D CNN and 92.19% for the 1D CNN with random-forest variable selection on roots (LIBS with Spectral Matrix and CNN). We must first reproduce these numbers, within a few points, on clean data before any corrupted-data comparison counts.

Two ablations isolate the key ingredient. The first is the same dynamic-programming aligner with squared error, which isolates the loss. The second is Huber-loss Coherent Point Drift, which isolates the dynamic-programming structure.

Why not just…?

Why not just train the classifier with random shift augmentation? This is the most serious threat. A CNN trained on randomly shifted spectra may become insensitive to fine drift with no alignment step at all. We include augmentation-only CNNs in every condition. Our prediction, which follows from the octave-error results of the MAE stylization paper and Sujith et al., is that augmentation absorbs fine drift but not gross misassignment. A swapped peak is a consistent but wrong feature, not a shifted copy of the right one. If augmentation matches the robust aligner at high $p$ as well, we will report that the aligner is unnecessary. The audit and oracle protocol would then be the contribution.

Why not just integrate peaks into a compound table with vendor deconvolution and NIST library matching? Peak tables remove the dependence on retention time only if compound identification is correct, and gross misassignment is exactly an identification error. This path is still a fair competitor. We will run it, and inject errors at the identification level so that it faces the same error budget. For the T. matsutake data this matters most: the 2,730 resolved compounds include many co-eluting isomers (GC×GC-TOF MS of T. matsutake).

Why not just use BARCHAN with a better-tuned kernel, or a robust Coherent Point Drift? That is precisely what the Huber-loss Coherent Point Drift ablation tests. If it closes the gap as well as the dynamic-programming aligner, the conclusion is that the loss matters and the pitch-derived structure does not. We will say so.

Why not just smooth or median-filter the drift estimate? Smoothing and median filtering correct small, scattered deviations. They do not correct coherent gross errors, because a consistently wrong baseline does not trigger outlier rejection (Sujith et al.). The squared-error dynamic-programming ablation covers this case directly.

Proposed Experiments and Decisive Checks

The core experiment runs the three-component program on the G. rigescens HPLC cohort (840 samples, 29 populations, four latitude zones) and the G. rigescens LIBS cohort (12 origins). Alignment fidelity is measured on BARCHAN's gas-oil Dataset 1 and Dataset 2. The T. matsutake data serve as a small-sample stress case. Because data availability is uncertain, we plan to request the raw files from the authors. As a fallback, we will acquire a replicate-run cohort of one species ourselves, with run order deliberately randomized against origin.

For every method, we will plot accuracy, MCC and marker stability against the drift magnitude $\sigma$ and the gross-error rate $p$.

Four results would settle the questions. First, if accuracy and marker stability stay near their clean values at realistic $\sigma$ and $p$, the audit's premise fails. We would report that published accuracies are robust. Second, if accuracy drops under batch-held-out splits but not under random splits, part of the reported accuracy reflects instrument state rather than geography. That is a finding of independent value to the provenance field. Third, if the absolute-error aligner recovers more of the oracle gap than BARCHAN, shift augmentation and Huber-loss Coherent Point Drift at high $p$, while tying them at $p=0$, then the asymmetry seen for pitch errors carries over to chromatography. Fourth, if the 2D LIBS CNN loses more accuracy than the 1D CNN under one-channel shifts, the generalization advantage claimed for folding does not hold up under drift.