spa_select — SPA — Successive Projections Algorithm

Group: Variable selector · Registry tolerance: 1e-06

Description

SPA Successive Projections (§18 Phase 5e)

Registry note — R plsVarSel::spa_pls randomization-based SPA (Forina et al.) — paired Wilcoxon variable importance, p < 0.05 survivor set (fallback to top-ncomp p-values). Default _spa_select_pls4all path mirrors the same R call with seed=11, giving bit-exact mask parity. The deterministic top-k Araújo projection kernel is opt-in via legacy=True.

Parameters

Name

Type

Default

Notes

top_k

int

required

current public binding signature

n_components

int

2

current public binding signature

Explanations

Bibliographic source

Araújo, M. C. U., Saldanha, T. C. B., Galvão, R. K. H., Yoneyama, T., Chame, H. C. & Visani, V. (2001). The successive projections algorithm for variable selection in spectroscopic multicomponent analysis. Chemometrics and Intelligent Laboratory Systems 57(2), 65–73. Verified primary link: https://doi.org/10.1016/S0169-7439(01)00119-8.

Mathematical principle

SPA is a greedy forward selector that seeks minimally collinear features. Starting from the feature with largest coefficient (or user-supplied seed), at each step it adds the feature whose direction is maximally orthogonal to all previously-selected features. Formally, at step \(m\) it picks \(j^{\star} = \arg\max_j \| \mathbf{P}_{S_{m-1}}^{\perp} \mathbf{x}_j \|_2\), where \(\mathbf{P}_{S}^{\perp}\) projects onto the orthogonal complement of the span of the already-selected features.

This produces a feature subset that is well-conditioned for downstream regression: the inverse \((\mathbf{X}_S^{\top}\mathbf{X}_S)^{-1}\) has small condition number by construction. SPA is therefore particularly effective when followed by MLR (or PLS with very few components) on the selected subset.

Stops at a user-specified top-\(k\). Computational cost: \(O(k\, n\, p)\).

Appropriate uses

Selecting minimally collinear wavelengths for compact spectrometer or interpretable calibration designs.

Limits and validation

SPA’s projection criterion is only indirectly response-aware and the starting variable/target subset size can change the result.

Implementation

n4m_feature_selection_spa_select. Reference: R plsVarSel.

Sources and provenance

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

API and bindings

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

Python (verified public re-export):

from n4m.feature_selection.wrapper import SPA

Source signature: SPA(top_k: int, *, n_components: int = 2) (n4m/_impl/selection.py).

R (source-verified): spa_select(X, Y, n_components, top_k).

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

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

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

Registry parity references 📐

  • 📐 ref.r_plsvarsel (R · r) — plsVarSel 0.10.0 · strict (rmse_rel ≤ 1e-06) — R plsVarSel::spa_pls — Successive Projections Algorithm.

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×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ J 1.00499.6 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.00515.0 ms
pls4all.sklearn⇄ J 0.121.97 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ J 0.124.72 ms
pls4all.R.formula⇄ J 0.126.23 ms
pls4all.R.mdatools⇄ J 0.125.86 ms
pls4all.R.pls⇄ J 0.125.75 ms
R · external
📐ref.r_plsvarselsource104.0 ms
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ J 1.00819.9 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.00530.6 ms
pls4all.sklearn⇄ J 0.121.90 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ J 0.125.33 ms
pls4all.R.formula⇄ J 0.125.81 ms
pls4all.R.mdatools⇄ J 0.1210.9 ms
pls4all.R.pls⇄ J 0.126.22 ms
R · external
📐ref.r_plsvarselsource164.5 ms
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ J 1.00557.0 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.00514.9 ms
pls4all.sklearn⇄ J 0.121.89 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ J 0.124.70 ms
pls4all.R.formula⇄ J 0.125.57 ms
pls4all.R.mdatools⇄ J 0.125.52 ms
pls4all.R.pls⇄ J 0.125.17 ms
R · external
📐ref.r_plsvarselsource179.5 ms

See also: benchmark overview · methods index · interactive dashboard