pds — Piecewise Direct Standardisation

Group: Calibration transfer · Registry tolerance: 1e-08

Description

PDS — Piecewise Direct Standardization (§13)

Registry note — Base R per-band lm.fit over a window of source bands — the canonical Wang 1991 PDS algorithm with no extra deps. Same algorithm as pls4all’s pds_fit modulo CSV-roundtrip precision.

Parameters

Name

Type

Default

Notes

window_half_width

int

2

registry benchmark cell value

Explanations

Bibliographic source

Wang, Y., Veltkamp, D. J. & Kowalski, B. R. (1991). Multivariate instrument standardization. Analytical Chemistry 63(23), 2750–2756. https://doi.org/10.1021/ac00023a016 — same paper as ds; PDS is introduced in §3 (piecewise local regression with a sliding window of width 2w+1).

Mathematical principle

PDS generalises DS by allowing the transfer to vary across wavelength bands. For each wavelength \(j\) on the primary instrument, a local regression maps a window of \(\pm w\) wavelengths from the secondary instrument: \(\hat{x}_{\mathrm{primary}, j} = \mathbf{x}_{\mathrm{secondary}, j-w:j+w} \cdot \mathbf{f}_j\). The full transfer matrix is then banded: only \(\pm w\) off-diagonal columns per row are non-zero.

PDS handles wavelength-dependent inter-instrument behaviour — wavelength-axis drift, resolution differences, detector non-linearities — that DS cannot. The window half-width \(w\) controls the locality: \(w=0\) recovers a diagonal-only transfer, \(w \to p/2\) recovers DS.

PDS is the de-facto standard in NIR / FT-IR calibration transfer; the prospectr R package’s implementation is considered canonical.

Appropriate uses

Local-window instrument standardization when wavelength-specific transfer maps are more plausible than one global map.

Limits and validation

Window width and paired-standard coverage control extrapolation; boundary wavelengths have less contextual support.

Implementation

n4m_domain_adaptation_pds_fit (TransformerMixin in tier 2). Reference: R prospectr::pds. Note: pls4all applies the transpose convention so that transform(X_secondary) returns the standardised primary-instrument estimate.

Sources and provenance

Current implementation: cpp/src/core/extra_pls.cpp.

API and bindings

C ABI (ABI 2): n4m_domain_adaptation_pds_fit. Use the linked public header for the exact signature, configuration, and result handles.

Python: no current AST-verified public n4m re-export was found for this method. The linked C ABI above is the documented surface in this checkout.

R (source-verified): pds_fit(X_source, X_target, window_half_width = 2L).

library(n4m)
result <- pds_fit(X_source, X_target)

MATLAB / Octave (source-verified): pds(X_source, X_target, window_half_width).

The source signature has additional required inputs, so no example call is fabricated.

Registry parity references 📐

  • 📐 ref.r_base (R · r) — base R 4.3.3 · strict (rmse_rel ≤ 1e-08) — Base R lm per spectral band — closest installable analog to Wang 1991 Piecewise Direct Standardization. With window_half_width=0 this reduces to Direct Standardization.

Benchmarks

Archived measurement identity. Backend labels in this table are the raw IDs recorded when the benchmark ran (including historical pls4all.* IDs). They preserve measurement provenance and do not describe a current public Python, R, or MATLAB binding; use the source-verified API and bindings section above for current entry points.

Adaptive wall-clock per cell measured against full_matrix.csv. Only backends that implement this method are listed; libraries without the method are omitted.

Verdict  ·  ✓ ref / ≈ ref / ~ shape mark a reference-gate pass at strict / relaxed / qualitative tolerance  ·  ✓ bind = archived binding-harness result agrees with the C++ baseline  ·  ⇄ cross-check = documented by-design selector/RNG/model, noncanonical API/facade convention, or secondary oracle  ·  ✗ divergent  ·  ⚠ error  ·  — not run. The fastest backend per column is marked 🏆.

Reference gate: strict — numeric equivalence (rmse_rel_tol ≤ 1e-08).

Rows tagged with 📐 are the canonical parity references for this method (declared in parity_timing.registry). C++ and external rows show reference parity; archived language-harness rows show binding parity against the C++ backend. Hover the icon for role and tolerance band.

BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 5e-091.37 ms🏆
Python · archived pls4all benchmark
pls4all.python✓ bind1.44 ms
pls4all.sklearn✓ 4e-161.86 ms
R · archived pls4all benchmark
pls4all.R✓ bind10.6 ms
pls4all.R.formula✓ bind10.1 ms
pls4all.R.mdatools✓ bind13.7 ms
pls4all.R.pls✓ bind14.2 ms
R · external
📐ref.r_basesource43.1 ms
BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 5e-092.54 ms🏆
Python · archived pls4all benchmark
pls4all.python✓ bind2.67 ms
pls4all.sklearn✓ 4e-167.45 ms
R · archived pls4all benchmark
pls4all.R✓ bind34.6 ms
pls4all.R.formula✓ bind34.8 ms
pls4all.R.mdatools✓ bind42.9 ms
pls4all.R.pls✓ bind49.1 ms
R · external
📐ref.r_basesource112.2 ms
BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 5e-096.67 ms
Python · archived pls4all benchmark
pls4all.python✓ bind3.05 ms
pls4all.sklearn✓ 4e-163.01 ms🏆
R · archived pls4all benchmark
pls4all.R✓ bind15.7 ms
pls4all.R.formula✓ bind18.9 ms
pls4all.R.mdatools✓ bind15.4 ms
pls4all.R.pls✓ bind10.5 ms
R · external
📐ref.r_basesource35.6 ms

See also: benchmark overview · methods index · interactive dashboard