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 |
|---|---|---|---|
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
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) —ikplsMISSING · strict (rmse_rel ≤ 1e-08) — ikpls.numpy_ikpls.PLS algorithm 1.📐
ref.python_scikit_learn(python · python) —scikit-learn1.7.2 · strict (rmse_rel ≤ 1e-08) — sklearn.cross_decomposition.PLSRegression(scale=False).📐
ref.r_mixomics(R · mixOmics) —mixOmics6.26.0 · strict (rmse_rel ≤ 1e-08) — Bioconductor mixOmics::pls(mode=’regression’, scale=FALSE).📐
ref.r_pls(R · r) —pls2.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.
| Backend | Parity | 200×50 (ms) |
|---|---|---|
| C++ native · libn4m | ||
pls4all.cpp.blas+omp | ✓ ref 6e-16 | 1.70 ms |
| Python · archived pls4all benchmark | ||
pls4all.python | ✓ bind | 1.69 ms🏆 |
pls4all.sklearn | ✓ bind | 1.97 ms |
| R · archived pls4all benchmark | ||
pls4all.R | ✓ 7e-15 | 4.79 ms |
pls4all.R.formula | ✓ 7e-15 | 5.26 ms |
pls4all.R.mdatools | ✓ 7e-15 | 5.92 ms |
pls4all.R.pls | ✓ 7e-15 | 9.99 ms |
| Python · external | ||
📐ref.python_ikpls | ⇄ +9e-03 | 1.92 ms |
📐ref.python_scikit_learn | source | 2.16 ms |
| R · external | ||
📐ref.r_mixomics | ⇄ +6e-16 | 9.72 ms |
📐ref.r_pls | ⇄ +1e-14 | 8.01 ms |
| Backend | Parity | 200×50 (ms) |
|---|---|---|
| C++ native · libn4m | ||
pls4all.cpp.blas+omp | ✓ ref 6e-16 | 1.79 ms |
| Python · archived pls4all benchmark | ||
pls4all.python | ✓ bind | 1.76 ms🏆 |
pls4all.sklearn | ✓ bind | 1.95 ms |
| R · archived pls4all benchmark | ||
pls4all.R | ✓ 7e-15 | 4.43 ms |
pls4all.R.formula | ✓ 7e-15 | 5.76 ms |
pls4all.R.mdatools | ✓ 7e-15 | 6.29 ms |
pls4all.R.pls | ✓ 7e-15 | 10.3 ms |
| Python · external | ||
📐ref.python_ikpls | ⇄ +9e-03 | 1.90 ms |
📐ref.python_scikit_learn | source | 2.16 ms |
| R · external | ||
📐ref.r_mixomics | ⇄ +6e-16 | 9.82 ms |
📐ref.r_pls | ⇄ +1e-14 | 7.50 ms |
| Backend | Parity | 200×50 (ms) |
|---|---|---|
| C++ native · libn4m | ||
pls4all.cpp.blas+omp | ✓ ref 6e-16 | 1.79 ms |
| Python · archived pls4all benchmark | ||
pls4all.python | ✓ bind | 1.78 ms🏆 |
pls4all.sklearn | ✓ bind | 1.93 ms |
| R · archived pls4all benchmark | ||
pls4all.R | ✓ 7e-15 | 4.69 ms |
pls4all.R.formula | ✓ 7e-15 | 5.49 ms |
pls4all.R.mdatools | ✓ 7e-15 | 5.59 ms |
pls4all.R.pls | ✓ 7e-15 | 10.4 ms |
| Python · external | ||
📐ref.python_ikpls | ⇄ +9e-03 | 2.04 ms |
📐ref.python_scikit_learn | source | 2.17 ms |
| R · external | ||
📐ref.r_mixomics | ⇄ +6e-16 | 9.91 ms |
📐ref.r_pls | ⇄ +1e-14 | 8.15 ms |
See also: benchmark overview · methods index · interactive dashboard