scars_select — SCARS — Stability-CARS

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

Description

SCARS stability + CARS (§18 Phase 5h)

Registry note — NumPy port of Stability CARS (Zheng 2014) — Monte-Carlo subsampling + stability scoring + CARS exponential shrinkage. Default _scars_select_pls4all path invokes the same NumPy function with np.random.default_rng(seed), giving bit-exact mask parity. The C++ splitmix64 kernel is opt-in via legacy=True.

Parameters

Name

Type

Default

Notes

n_components

int

2

current public binding signature

n_iterations

int

50

current public binding signature

min_features

int | None

None

current public binding signature

sample_fraction

float

0.8

current public binding signature

n_folds

int

3

current public binding signature

seed

int

0

current public binding signature

Explanations

Bibliographic source

Zheng, K., Li, Q., Wang, J., Geng, J., Cao, P., Sui, T., Wang, X. & Du, Y. (2012). Stability competitive adaptive reweighted sampling (SCARS) and its applications to multivariate calibration of NIR spectra. Chemometrics and Intelligent Laboratory Systems 112, 48–54. Verified primary link: https://doi.org/10.1016/j.chemolab.2012.01.002.

Mathematical principle

Replace CARS’s coefficient-magnitude weights with coefficient-stability weights: \(w_j = |\bar{b}_j| / s(b_j)\) from the bootstrap distribution. Stability-weighted retention is more robust to spurious high-magnitude coefficients caused by particular bootstrap subsamples.

Otherwise identical to CARS: exponential decay schedule and stochastic competition. SCARS typically improves CARS on datasets with strong baseline drift or where a few high-leverage samples dominate the coefficient estimates.

Appropriate uses

Sequential competitive elimination of weak wavelengths across repeated PLS evaluations.

Limits and validation

Aggressive elimination is irreversible within a run and can discard correlated alternatives; validation reuse creates optimism.

Implementation

n4m_feature_selection_scars_select.

Sources and provenance

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

API and bindings

C ABI (ABI 2): n4m_feature_selection_scars_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 SCARS

Source signature: SCARS(*, n_components: int = 2, n_iterations: int = 50, min_features: int | None = None, sample_fraction: float = 0.8, n_folds: int = 3, seed: int = 0) (n4m/_impl/selection.py).

R (source-verified): scars_select(X, Y, n_components, n_iterations = 50L, min_features = 5L, sample_fraction = 0.8, seed = 0L).

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

MATLAB / Octave (source-verified): scars_select(X, Y, n_components, n_iterations, min_features, ... sample_fraction, seed).

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

Registry parity references 📐

  • 📐 ref.python_scars_numpy_port (python · python) — scars_numpy_port 1.0.0 · strict (rmse_rel ≤ 1e-06) — NumPy port of Stability CARS (Zheng 2014) — Monte-Carlo subsampling + stability scoring + CARS exponential shrinkage. Pinned np.random.default_rng(seed) for bit-exact reproducibility.

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.007.65 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.0010.2 ms
pls4all.sklearn⇄ J 0.334.14 ms
R · archived pls4all benchmark
pls4all.R⇄ J 0.334.85 ms
pls4all.R.formula⇄ J 0.335.55 ms
pls4all.R.mdatools⇄ J 0.335.92 ms
pls4all.R.pls⇄ J 0.335.72 ms
Python · external
📐ref.python_scars_numpy_portsource3.61 ms🏆
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ J 1.003.71 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.003.88 ms
pls4all.sklearn⇄ J 0.332.29 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ J 0.335.06 ms
pls4all.R.formula⇄ J 0.337.16 ms
pls4all.R.mdatools⇄ J 0.336.22 ms
pls4all.R.pls⇄ J 0.336.17 ms
Python · external
📐ref.python_scars_numpy_portsource3.67 ms
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ J 1.003.66 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.003.91 ms
pls4all.sklearn⇄ J 0.332.22 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ J 0.334.89 ms
pls4all.R.formula⇄ J 0.3314.1 ms
pls4all.R.mdatools⇄ J 0.3317.6 ms
pls4all.R.pls⇄ J 0.3312.6 ms
Python · external
📐ref.python_scars_numpy_portsource9.38 ms

See also: benchmark overview · methods index · interactive dashboard