01 · Measure
A square-wave scan
The potential steps from 0 to 0.8 V in 4 mV increments with a 25 mV, 5 Hz square wave on top; at each step the instrument records the difference current. That gives 200 numbers per curve — the only input the model ever sees.
Each analyte oxidises at its own potential and leaves a peak. On PVDF-coated chips the four peaks sit apart; on P4VP they crowd into roughly 0.13–0.22 V, which is why reading them is not a matter of finding one bump.
02 · Denoise
Noise out, shape kept
The curve is split with a three-level sym4 wavelet transform. The finest band is mostly noise, so its median absolute deviation estimates the noise level σ. Every detail coefficient is shrunk towards zero by λ = σ√(2 ln 200) — the universal threshold — and the curve is rebuilt.
What is removed is tiny and random; peak heights and positions survive. No blank is subtracted: the model learned from the raw current.
03 · Decompose
Seven views of one curve
A six-level rbio1.3 transform splits the denoised curve into seven bands, from the coarse shape (cA6) to the finest wiggles (cD1). Added together, the bands give back the curve exactly.
Coarse bands describe where peaks are and how tall; fine bands carry little. Six levels on 200 points is deep enough that the coarsest coefficients feel the ends of the scan — a boundary effect the explanations had to account for.
04 · Standardise
228 numbers
All coefficients of all bands are kept: 8 + 8 + 11 + 17 + 29 + 53 + 102 = 228. Each is converted to a z-score with the mean and spread it had across the 1,114 training curves.
A value far outside ±3 means this curve looks unlike the training data in that coefficient. The model has no other notion of "unusual".
05 · Vote
Four forests, built tree by tree
Each analyte has its own LightGBM model: 300 small trees, 31 leaves each, trained one after another so that every tree corrects the ones before it. Each tree reads a few coefficients and adds a small amount to the log-odds.
The figure shows that sum as the trees are added. Present analytes climb, absent ones fall; most of the decision is made in the first hundred trees.
06 · Decide
A threshold chosen on training data
The final log-odds become a probability through the logistic function. A curve is called positive for an analyte when that probability reaches the threshold that maximised sensitivity plus specificity on the real training curves — between 0.49995 and 0.50000 for the four models.
Four independent decisions: the model can say "ascorbic acid and estradiol, not serotonin" without forcing the answers to agree. Why it decided is the next question.