pls — PLS regression (SIMPLS)

Group: Core PLS · Registry tolerance: 1e-08

Description

SIMPLS PLS regression baseline

Registry note — Baseline SIMPLS cell. sklearn uses NIPALS and ikpls uses improved-kernel PLS, so exact bit parity is not expected; the row exists to anchor timing comparisons.

Parameters

Name

Type

Default

Notes

X

—

required

current public binding signature

y

—

required

current public binding signature

n_components

int

2

current public binding signature

pls_components

—

None

current public binding signature

cv

int

5

current public binding signature

fold_ids

—

None

current public binding signature

center_x

bool | None

None

current public binding signature

scale_x

bool | None

None

current public binding signature

center_y

bool | None

None

current public binding signature

scale_y

bool | None

None

current public binding signature

cuda_pls_parallel_folds

bool | None

None

current public binding signature

cuda_pls_min_device_features

int | None

None

current public binding signature

cuda_pls_many_batched

bool | None

None

current public binding signature

Explanations

Bibliographic source

de Jong, S. (1993). SIMPLS: an alternative approach to partial least squares regression. Chemometrics and Intelligent Laboratory Systems 18(3), 251–263. DOI 10.1016/0169-7439(93)85002-X.

Mathematical principle

Partial Least Squares regression seeks a set of latent directions in the predictor space that maximise the covariance with the response, in contrast to PCA which maximises only the variance of \(\mathbf{X}\).

Given centred \(\mathbf{X} \in \mathbb{R}^{n\times p}\) and \(\mathbf{Y} \in \mathbb{R}^{n\times q}\), the first PLS component is the unit-norm direction \(\mathbf{w}_1\) maximising \(\operatorname{Cov}(\mathbf{X}\mathbf{w}_1, \mathbf{Y})\). Closed form: \(\mathbf{w}_1 \propto \mathbf{X}^{\top}\mathbf{Y}\) (or its dominant left singular vector when \(q>1\)). Subsequent components are extracted from the deflated residual matrix so the resulting scores \(\mathbf{T} = \mathbf{X}\mathbf{W}\) are orthogonal.

SIMPLS (de Jong 1993) is algebraically equivalent to NIPALS but computes the loading weights directly from the cross-product \(\mathbf{S} = \mathbf{X}^{\top}\mathbf{Y}\) without re-deflating \(\mathbf{X}\) at each step. This avoids accumulating floating-point error from iterative deflation and runs in roughly half the time of NIPALS for the same number of components. SIMPLS is the variant exposed by MATLAB’s plsregress.

Once \(k\) latent scores have been extracted the regression coefficients are reconstructed as \(\mathbf{B} = \mathbf{W}(\mathbf{P}^{\top}\mathbf{W})^{-1}\mathbf{Q}^{\top}\), where \(\mathbf{P}, \mathbf{Q}\) are the X- and Y-loadings. Predictions on new \(\mathbf{X}^{\star}\) follow \(\hat{\mathbf{Y}} = \mathbf{X}^{\star}\mathbf{B} + \bar{\mathbf{y}}\). The choice of \(k\) trades bias and variance: use cross-validated PRESS or the one-SE rule of Hastie et al. (2009) to select it.

Appropriate uses

Linear multivariate calibration when predictors are numerous, collinear, and response-linked latent directions are useful.

Limits and validation

Predictions remain linear in X; component count and preprocessing must be validated without leaking validation samples.

Implementation

Dispatched through Algorithm.PLS_REGRESSION + Solver.SIMPLS in libn4m (the n4m_model_fit C entry point). The same Model.fit / Model.predict surface is used by every binding. NIPALS, SVD, power-iteration, randomised-SVD, orthogonal-scores, kernel and wide-kernel solver variants are all available — see the Solver enum.

Sources and provenance

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

API and bindings

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

Python (verified public re-export):

from n4m.estimators.regression.latent import pls
result = pls(X, y)

Source signature: pls(X, y, *, n_components: int = 2, pls_components = None, cv: int = 5, fold_ids = None, center_x: bool | None = None, scale_x: bool | None = None, center_y: bool | None = None, scale_y: bool | None = None, cuda_pls_parallel_folds: bool | None = None, cuda_pls_min_device_features: int | None = None, cuda_pls_many_batched: bool | None = None) (n4m/_impl/native.py).

R (source-verified): pls(formula, data, ncomp = 2L, algo = "pls_nipals", na.action = stats::na.omit, ...).

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

MATLAB / Octave (source-verified): pls_fit(X, Y, n_components).

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

Registry parity references 📐

  • 📐 ref.python_ikpls (python · ikpls) — ikpls MISSING · strict (rmse_rel ≤ 1e-08) — ikpls.numpy_ikpls.PLS algorithm 1.

  • 📐 ref.python_scikit_learn (python · python) — scikit-learn 1.7.2 · strict (rmse_rel ≤ 1e-08) — sklearn.cross_decomposition.PLSRegression(scale=False).

  • 📐 ref.r_mixomics (R · mixOmics) — mixOmics 6.26.0 · strict (rmse_rel ≤ 1e-08) — Bioconductor mixOmics::pls(mode=’regression’, scale=FALSE).

  • 📐 ref.r_pls (R · r) — pls 2.8.5 · strict (rmse_rel ≤ 1e-08) — R pls::plsr(method=’simpls’, scale=FALSE).

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×50 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 6e-161.70 ms
Python · archived pls4all benchmark
pls4all.python✓ bind1.69 ms🏆
pls4all.sklearn✓ bind1.97 ms
R · archived pls4all benchmark
pls4all.R✓ 7e-154.79 ms
pls4all.R.formula✓ 7e-155.26 ms
pls4all.R.mdatools✓ 7e-155.92 ms
pls4all.R.pls✓ 7e-159.99 ms
Python · external
📐ref.python_ikpls⇄ +9e-031.92 ms
📐ref.python_scikit_learnsource2.16 ms
R · external
📐ref.r_mixomics⇄ +6e-169.72 ms
📐ref.r_pls⇄ +1e-148.01 ms
BackendParity200×50 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 6e-161.79 ms
Python · archived pls4all benchmark
pls4all.python✓ bind1.76 ms🏆
pls4all.sklearn✓ bind1.95 ms
R · archived pls4all benchmark
pls4all.R✓ 7e-154.43 ms
pls4all.R.formula✓ 7e-155.76 ms
pls4all.R.mdatools✓ 7e-156.29 ms
pls4all.R.pls✓ 7e-1510.3 ms
Python · external
📐ref.python_ikpls⇄ +9e-031.90 ms
📐ref.python_scikit_learnsource2.16 ms
R · external
📐ref.r_mixomics⇄ +6e-169.82 ms
📐ref.r_pls⇄ +1e-147.50 ms
BackendParity200×50 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 6e-161.79 ms
Python · archived pls4all benchmark
pls4all.python✓ bind1.78 ms🏆
pls4all.sklearn✓ bind1.93 ms
R · archived pls4all benchmark
pls4all.R✓ 7e-154.69 ms
pls4all.R.formula✓ 7e-155.49 ms
pls4all.R.mdatools✓ 7e-155.59 ms
pls4all.R.pls✓ 7e-1510.4 ms
Python · external
📐ref.python_ikpls⇄ +9e-032.04 ms
📐ref.python_scikit_learnsource2.17 ms
R · external
📐ref.r_mixomics⇄ +6e-169.91 ms
📐ref.r_pls⇄ +1e-148.15 ms

See also: benchmark overview · methods index · interactive dashboard