ds — Direct Standardisation

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

Description

DS — Direct Standardization (§13)

Registry note — Base R per-band lm.fit with window_half_width=0 — Direct Standardization is just per-band linear regression.

No tunable parameters declared at the binding level.

Explanations

Bibliographic source

Wang, Y., Veltkamp, D. J. & Kowalski, B. R. (1991). Multivariate instrument standardisation. Analytical Chemistry 63(23), 2750–2756. Verified primary link: https://doi.org/10.1021/ac00023a016.

Mathematical principle

Direct Standardisation (DS) learns a single global transfer matrix \(\mathbf{F}\) that maps secondary-instrument spectra back onto the primary instrument: \(\hat{\mathbf{X}}_{\mathrm{primary}} = \mathbf{X}_{\mathrm{secondary}} \mathbf{F}\). The matrix is fit by least squares on a small set of transfer-standard samples measured on both instruments, typically with a Tikhonov ridge for stability.

DS is the simplest member of the calibration-transfer family and works well when the inter-instrument response is approximately linear and stationary — i.e. when instrument differences amount to a constant linear transformation that is invariant across the spectrum. When the transformation varies across wavelength bands (common in dispersive vs FT spectrometers) the global transfer matrix produces band-mixing artefacts and PDS should be used instead.

A canonical workflow: fit DS on \(\le 30\) transfer standards, apply \(\mathbf{F}\) to all subsequent secondary-instrument spectra, then use a single PLS model fit only on primary data.

Appropriate uses

Transferring spectra from a secondary instrument to a reference instrument using paired standards.

Limits and validation

Requires representative paired transfer samples and a stable linear relation between instruments.

Implementation

n4m_domain_adaptation_ds_fit (TransformerMixin in tier 2). Reference: R chemometrics::stdize.

Sources and provenance

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

API and bindings

C ABI (ABI 2): n4m_domain_adaptation_ds_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): ds_fit(X_source, X_target).

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

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

addpath('bindings/matlab')
result = n4m.ds(X_source, X_target);

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 6e-091.64 ms🏆
Python · archived pls4all benchmark
pls4all.python✓ bind2.09 ms
pls4all.sklearn✓ 9e-162.27 ms
R · archived pls4all benchmark
pls4all.R✓ bind10.2 ms
pls4all.R.formula✓ bind14.0 ms
pls4all.R.mdatools✓ bind11.4 ms
pls4all.R.pls✓ bind12.6 ms
R · external
📐ref.r_basesource31.0 ms
BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 6e-093.32 ms
Python · archived pls4all benchmark
pls4all.python✓ bind1.57 ms🏆
pls4all.sklearn✓ 9e-161.72 ms
R · archived pls4all benchmark
pls4all.R✓ bind11.1 ms
pls4all.R.formula✓ bind11.8 ms
pls4all.R.mdatools✓ bind10.7 ms
pls4all.R.pls✓ bind13.0 ms
R · external
📐ref.r_basesource27.8 ms
BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 6e-091.42 ms🏆
Python · archived pls4all benchmark
pls4all.python✓ bind2.13 ms
pls4all.sklearn✓ 9e-161.72 ms
R · archived pls4all benchmark
pls4all.R✓ bind8.95 ms
pls4all.R.formula✓ bind9.70 ms
pls4all.R.mdatools✓ bind9.43 ms
pls4all.R.pls✓ bind10.1 ms
R · external
📐ref.r_basesource28.0 ms

See also: benchmark overview · methods index · interactive dashboard