sparse_simpls — Sparse SIMPLS (Chun & Keleş 2010)¶
Group: Sparse · Registry tolerance: 1.0
Description¶
Sparse SIMPLS with soft-threshold lambda
From the pls4all.sklearn.SparseSimplsRegression docstring:
Sparse SIMPLS with soft-thresholded weights (Chun & Keles 2010).
Registry note — R
spls2.3.2 (Chun & Keles 2010) is the canonical external reference. The in-tree NumPy portSparseSimplsPythonReferenceprovides a hermetic alternative when R is unavailable.
Parameters¶
Name |
Type |
Default |
Notes |
|---|---|---|---|
|
|
|
Number of latent components extracted (k). |
|
|
|
L1 soft-threshold magnitude applied to the PLS weight vectors. |
Explanations¶
Bibliographic source¶
Chun, H. & Keleş, S. (2010). Sparse partial least squares regression for simultaneous dimension reduction and variable selection. JRSS B 72(1), 3–25.
Mathematical principle¶
Sparse PLS adds a soft-thresholding step to each SIMPLS loading weight so that the latent direction is supported on only a small subset of features. Mathematically, after the un-thresholded weight \(\mathbf{w}\) is computed, we solve \(\mathbf{w}^{\star} = \arg\min_{\|\mathbf{c}\|=1} \|\mathbf{c} - \mathbf{w}\|_2^2 + \lambda \|\mathbf{c}\|_1\), which has the closed-form soft-threshold solution \(c_j = \operatorname{sign}(w_j)\,(|w_j| - \lambda/2)_+\) followed by re-normalisation.
The penalty \(\lambda\) controls sparsity: small \(\lambda\) approaches standard PLS, large \(\lambda\) zeroes most weights. In high-dimensional (\(p \gg n\)) spectroscopy or omics data, sparse PLS simultaneously builds the latent predictive direction and selects the variables that support it — a much cleaner story than running PLS then thresholding coefficients post-hoc.
The Chun & Keleş formulation differs subtly from the earlier Lê Cao 2008 sPLS (used in mixOmics): Chun & Keleş threshold the un-deflated weight while Lê Cao threshold the deflated weight at each iteration. pls4all implements the Chun & Keleş formulation.
Implementation¶
n4m_sparse_simpls_fit. Reference: CRAN spls 2.3.2 (Chun & Keleş authors). No widely installable Python port exists with this exact normalisation convention.
MATLAB header (bindings/matlab/+pls4all/SparsePlsRegression.m):
pls4all.SparsePlsRegression — Sparse SIMPLS (Chun & Keles 2010)
as a tier-2 classdef. Construct via the factory:
mdl = pls4all.fitrsparsepls(X, y, "NumComponents", 5, "Lambda", 0.05)
or directly:
Usage¶
Every pls4all binding tab dispatches into the same C kernel; the external libraries listed at the bottom of the page are the parity references registered in benchmarks.parity_timing.registry. Switch tabs to read the same fit in your language. The R package now ships drop-in-compatible facades for the CRAN pls package (plsr, pcr, mvr) and for the mdatools::pls(x, y, ...) matrix idiom — those tabs appear only on the methods that have a meaningful equivalence.
pls4all bindings
/* C ABI — libn4m */
n4m_context_t* ctx = n4m_context_create();
n4m_config_t* cfg = n4m_config_create();
n4m_method_result_t* res = NULL;
n4m_sparse_simpls_fit(ctx, cfg, &x_view, &y_view, /* hyperparams */, &res);
/* … read coefficients / mask / scores via */
/* n4m_method_result_get_double_matrix / vector / scalar … */
n4m_method_result_destroy(res);
n4m_config_destroy(cfg);
n4m_context_destroy(ctx);
import pls4all
from pls4all._methods import sparse_simpls_fit
with pls4all.Context() as ctx, pls4all.Config() as cfg:
res = sparse_simpls_fit(ctx, cfg, X, y, n_components=4)
# then: res.matrix("predictions"), res.matrix("coefficients"),
# res.vector("mask"), res.scalar("intercept"), …
from pls4all.sklearn import SparseSimplsRegression
mdl = SparseSimplsRegression(n_components=2, sparsity_lambda=0.05)
mdl.fit(X, y)
y_hat = mdl.predict(X_test)
library(pls4all)
# Unified low-level dispatcher (May 2026 R cleanup):
res <- pls4all_method("sparse_simpls", X, y,
n_components = 4L, params = list(sparsity_lambda = 0.05))
# res is a named list with MethodResult arrays/scalars.
# selected_indices / top_k_intervals are 1-based.
res = pls4all.sparse_simpls(X, y, 4);
% see header of bindings/matlab/+pls4all/sparse_simpls.m for full
% parameter surface:
% res = sparse_simpls(X, Y, n_components, sparsity_lambda)
yhat = predict(res, Xtest);
mdl = pls4all.fit("sparse_simpls", X, y, "NumComponents", 4);
yhat = predict(mdl, Xtest);
Registry parity references 📐
📐
ref.python_chun_keles_spls(python · python) —chun_keles_spls1.0 · qualitative (rmse_rel ≤ 1e+00) — In-tree NumPy port of Chun & Keles 2010 sparse PLS (the defaultpls2/simplsconfiguration of Rspls::spls). Verified against the R 2.3.2 package on the parity cells.📐
ref.r_spls(R · r) —spls2.3.2 · qualitative (rmse_rel ≤ 1e+00) — Rspls2.3.2 (Chun & Keles). Predicts via the regression coefficient matrix from sparse-thresholded SIMPLS.
Benchmarks¶
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 = pls4all binding 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; pls4all language bindings 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 7e-16 | 1.89 ms |
| Python · pls4all | ||
pls4all.python | ✓ bind | 1.93 ms |
pls4all.sklearn | ✓ bind | 1.88 ms🏆 |
| R · pls4all | ||
pls4all.R | ✓ 5e-15 | 4.60 ms |
pls4all.R.formula | ✓ 5e-15 | 5.64 ms |
pls4all.R.mdatools | ✓ 5e-15 | 6.30 ms |
pls4all.R.pls | ✓ 5e-15 | 5.36 ms |
| Python · external | ||
📐ref.python_chun_keles_spls | source | 3.55 ms |
| R · external | ||
📐ref.r_spls | ⇄ +6e-15 | 13.4 ms |
| Backend | Parity | 200×50 (ms) |
|---|---|---|
| C++ native · libn4m | ||
pls4all.cpp.blas+omp | ✓ ref 7e-16 | 1.93 ms |
| Python · pls4all | ||
pls4all.python | ✓ bind | 1.87 ms🏆 |
pls4all.sklearn | ✓ bind | 1.92 ms |
| R · pls4all | ||
pls4all.R | ✓ 5e-15 | 4.97 ms |
pls4all.R.formula | ✓ 5e-15 | 6.05 ms |
pls4all.R.mdatools | ✓ 5e-15 | 6.32 ms |
pls4all.R.pls | ✓ 5e-15 | 5.77 ms |
| Python · external | ||
📐ref.python_chun_keles_spls | source | 3.54 ms |
| R · external | ||
📐ref.r_spls | ⇄ +6e-15 | 12.8 ms |
| Backend | Parity | 200×50 (ms) |
|---|---|---|
| C++ native · libn4m | ||
pls4all.cpp.blas+omp | ✓ ref 7e-16 | 1.91 ms🏆 |
| Python · pls4all | ||
pls4all.python | ✓ bind | 1.98 ms |
pls4all.sklearn | ✓ bind | 1.95 ms |
| R · pls4all | ||
pls4all.R | ✓ 5e-15 | 4.83 ms |
pls4all.R.formula | ✓ 5e-15 | 5.49 ms |
pls4all.R.mdatools | ✓ 5e-15 | 6.00 ms |
pls4all.R.pls | ✓ 5e-15 | 5.74 ms |
| Python · external | ||
📐ref.python_chun_keles_spls | source | 3.58 ms |
| R · external | ||
📐ref.r_spls | ⇄ +6e-15 | 12.0 ms |
See also: benchmark overview · methods index · interactive dashboard