random_subspace_pls — Random-subspace PLS

Group: Ensemble · Registry tolerance: 1e-06

Description

Random-subspace PLS (§20)

Registry note — sklearn BaggingRegressor(PLSRegression(scale=False), max_features=k, bootstrap=False, bootstrap_features=False, max_samples=1.0). pls4all’s default now mirrors this convention exactly (same RNG, feature-subset order, and prediction averaging), so the gate is bit-for-bit. The legacy single-pass C++ kernel (splitmix feature shuffle + coefficient averaging) is opt-in via legacy=True.

Parameters

Name

Type

Default

Notes

n_components

int

4

registry benchmark cell value

n_estimators

int

10

registry benchmark cell value

features_per_subspace

int

20

registry benchmark cell value

seed

int

42

registry benchmark cell value

Explanations

Bibliographic source

Ho, T. K. (1998). The random subspace method for constructing decision forests. IEEE TPAMI 20(8), 832–844. — adapted for PLS regressors. Verified primary link: https://doi.org/10.1109/34.709601.

Mathematical principle

Each ensemble member fits PLS on a random subset of \(m \ll p\) features. Compared to bagging (which randomises rows), random subspaces randomise columns, which is a much stronger variance-reduction mechanism for high-dimensional collinear data like NIR spectra: different subsets pick up different bands of the spectrum, and averaging across them smooths out band-specific noise.

Variance per member is higher than a full-feature PLS (less information per fit), but the ensemble average outperforms a single fit when the underlying truth is spread across many weakly-correlated features. Choosing \(m \approx \sqrt{p}\) is a Breiman-style default; for spectra a more informed choice respects band widths.

Note that prediction on a new sample requires evaluating every member on its own subset of features, so the feature-index map must be stored per member.

Appropriate uses

Ensembling PLS fits across random wavelength subsets to reduce dependence on any one correlated region.

Limits and validation

Small subspaces can omit important bands and large ensembles increase fitting cost; the random seed affects the selected subsets.

Implementation

n4m_ensemble_random_subspace_pls_fit.

Sources and provenance

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

API and bindings

C ABI (ABI 2): n4m_ensemble_random_subspace_pls_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): random_subspace_pls(formula, data, ncomp = 2L, n_estimators = 50L, features_per_subspace = 10L, seed = 0L, na.action = stats::na.omit).

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

MATLAB / Octave (source-verified): random_subspace_pls(X, Y, n_components, n_estimators, ... features_per_subspace, seed).

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

Registry parity references 📐

  • 📐 ref.python_scikit_learn (python · python) — scikit-learn 1.8.0 · strict (rmse_rel ≤ 1e-06) — sklearn BaggingRegressor(PLSRegression(), max_features=…, bootstrap=False). Random feature subspaces with full sample rows, matching pls4all’s sampling shape. RNG differs from pls4all; qualitative parity.

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-06).

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✓ ref13.5 ms
Python · archived pls4all benchmark
pls4all.python✓ bind13.2 ms
pls4all.sklearn⇄ +9e-011.54 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ +9e-015.11 ms
pls4all.R.formula⇄ +9e-015.82 ms
pls4all.R.mdatools⇄ +9e-016.22 ms
pls4all.R.pls⇄ +9e-015.56 ms
Python · external
📐ref.python_scikit_learnsource13.0 ms
BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref12.1 ms
Python · archived pls4all benchmark
pls4all.python✓ bind13.6 ms
pls4all.sklearn⇄ +9e-012.67 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ +9e-014.41 ms
pls4all.R.formula⇄ +9e-015.82 ms
pls4all.R.mdatools⇄ +9e-016.51 ms
pls4all.R.pls⇄ +9e-016.01 ms
Python · external
📐ref.python_scikit_learnsource10.4 ms
BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref9.97 ms
Python · archived pls4all benchmark
pls4all.python✓ bind11.1 ms
pls4all.sklearn⇄ +9e-011.65 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ +9e-014.27 ms
pls4all.R.formula⇄ +9e-015.12 ms
pls4all.R.mdatools⇄ +9e-017.43 ms
pls4all.R.pls⇄ +9e-015.33 ms
Python · external
📐ref.python_scikit_learnsource26.1 ms

See also: benchmark overview · methods index · interactive dashboard