mb_pls — Multi-block PLS (Westerhuis 1998)

Group: Multi-block / cross-modal · Registry tolerance: 1e-08

Description

MB-PLS — Multi-block PLS (§17 Phase 4)

Registry note — In-tree nirs4all.operators.models.sklearn.mbpls.MBPLS is the sanctioned external reference (the mbpls PyPI package is broken against sklearn 1.8). pls4all’s MB-PLS default now mirrors nirs4all NIPALS multi-block (standardize=False); the legacy block-balanced SIMPLS path is opt-in via cfg.scale_x=True.

Parameters

Name

Type

Default

Notes

n_components

int

3

registry benchmark cell value

n_blocks

int

3

registry benchmark cell value

Explanations

Bibliographic source

Westerhuis, J. A., Kourti, T. & MacGregor, J. F. (1998). Analysis of multiblock and hierarchical PCA and PLS models. Journal of Chemometrics 12(5), 301–321. Verified primary link: https://doi.org/10.1002/(SICI)1099-128X(199809/10)12:5%3C301::AID-CEM515%3E3.0.CO;2-S.

Mathematical principle

When predictors come from several distinct sources — NIR, MIR, Raman, process tags, lab assays — concatenating them into one wide matrix lets the block with the most variance dominate. Multi-block PLS instead block-scales each \(\mathbf{X}_b\) so blocks contribute proportionally to their information content rather than their dimensionality.

Formally, each block is centred and autoscaled, then scaled by \(1 / \sqrt{p_b}\) so its total variance is unit-normalised. PLS then runs on the concatenated \([\mathbf{X}_1, \ldots, \mathbf{X}_B]\) with optional per-block weights. Block-level importance statistics (block-VIP, block-RMSE) are recovered from the loadings by restriction to each block’s columns.

Compared to plain concatenation, MB-PLS gives interpretable per-block contributions and is the standard approach in process spectroscopy.

Appropriate uses

Joint calibration from explicitly defined predictor blocks such as instruments, spectral ranges, or sensor families.

Limits and validation

Block scaling determines influence; concatenation-compatible outputs should not be interpreted as proving block-specific causality.

Implementation

n4m_estimators_mb_pls_fit — requires a block_sizes integer vector summing to \(p\). The C ABI materialises the intercept directly (no separate \(\bar{\mathbf{y}}\) key) because the block scaling changes the centring semantics. Reference: sanctioned git-pinned port nirs4all.operators.models.sklearn.mbpls.

Sources and provenance

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

API and bindings

C ABI (ABI 2): n4m_estimators_mb_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): mb_pls(formula, data, ncomp = 2L, block_sizes, na.action = stats::na.omit).

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

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

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

Registry parity references 📐

  • 📐 nirs4all (python · python) — nirs4all in-tree · strict (rmse_rel ≤ 1e-08) — In-tree Python MB-PLS (sanctioned external reference). The mbpls PyPI package is broken against sklearn 1.8 (uses the deprecated force_all_finite kwarg). nirs4all’s implementation is a clean re-derivation of Westerhuis 1998.

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×60 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 7e-162.37 ms🏆
Python · archived pls4all benchmark
pls4all.python✓ bind2.85 ms
pls4all.sklearn✓ 4e-152.59 ms
R · archived pls4all benchmark
pls4all.R✓ bind7.82 ms
pls4all.R.formula✓ bind10.9 ms
pls4all.R.mdatools✓ bind11.5 ms
pls4all.R.pls✓ bind10.2 ms
Python · external
📐nirs4allsource2.99 ms
BackendParity200×60 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 7e-162.33 ms
Python · archived pls4all benchmark
pls4all.python✓ bind2.24 ms🏆
pls4all.sklearn✓ 4e-152.55 ms
R · archived pls4all benchmark
pls4all.R✓ bind7.24 ms
pls4all.R.formula✓ bind10.4 ms
pls4all.R.mdatools✓ bind9.38 ms
pls4all.R.pls✓ bind9.18 ms
Python · external
📐nirs4allsource7.12 ms
BackendParity200×60 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 7e-1613.6 ms
Python · archived pls4all benchmark
pls4all.python✓ bind8.63 ms🏆
pls4all.sklearn✓ 4e-159.61 ms
R · archived pls4all benchmark
pls4all.R✓ bind30.4 ms
pls4all.R.formula✓ bind46.5 ms
pls4all.R.mdatools✓ bind48.5 ms
pls4all.R.pls✓ bind41.0 ms
Python · external
📐nirs4allsource9.70 ms

See also: benchmark overview · methods index · interactive dashboard