one_se_rule — One-SE rule for component selection

Group: Diagnostic · Registry tolerance: 1e-06

Description

One-SE component selection rule (§10)

Registry note — R pls::plsr(validation='CV', segment.type='consecutive', method='simpls', scale=FALSE) + onesigma rule. pls4all’s wrapper runs the same consecutive-fold CV with a SIMPLS kernel matching pls::simpls.fit bit-for-bit, then feeds the pooled per-component RMSEP into the C-side n4m_metrics_one_se_rule_compute. Per-component CV-RMSEP vectors agree to ~1e-12.

Parameters

Name

Type

Default

Notes

max_components

int

8

registry benchmark cell value

n_folds

int

5

registry benchmark cell value

Explanations

Bibliographic source

Hastie, T., Tibshirani, R. & Friedman, J. (2009). The Elements of Statistical Learning, 2nd ed., Springer, §7.10. Verified primary link: https://doi.org/10.1007/978-0-387-84858-7.

Mathematical principle

Cross-validated RMSE as a function of \(k\) is typically U-shaped with a relatively flat minimum. Picking the absolute minimum \(k^{\star}\) can over-fit because it exploits sampling noise. The one-SE rule instead picks the smallest \(k\) whose CV-RMSE is within one standard error of \(\mathrm{RMSE}(k^{\star})\).

This yields a more parsimonious model with negligible predictive cost — the smaller-\(k\) alternative is indistinguishable from the optimum within the noise of the CV estimate. The rule is non-parametric (no assumption about the CV-RMSE distribution) and is the standard practice in regularised regression (glmnet, pls::pls).

Inputs: a fold × component RMSE matrix from cross-validation. Output: an integer component count.

Appropriate uses

Choosing a parsimonious component count whose cross-validation error is statistically indistinguishable from the minimum.

Limits and validation

The result depends on fold construction and on how the standard error is computed across genuinely independent validation units.

Implementation

n4m_metrics_one_se_rule_compute. Returns an integer.

Sources and provenance

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

API and bindings

C ABI (ABI 2): n4m_metrics_one_se_rule_compute. 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): one_se_rule(fold_rmse_matrix).

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

MATLAB / Octave (source-verified): one_se_rule(fold_rmse_matrix).

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

Registry parity references 📐

  • 📐 ref.r_pls (R · r) — pls 2.8.5 · strict (rmse_rel ≤ 1e-06) — R pls::plsr(validation='CV', segment.type='consecutive', method='simpls', scale=FALSE) + pls::selectNcomp(method='onesigma'). The pls4all wrapper performs the same consecutive-fold CV with a SIMPLS kernel matching pls::simpls.fit bit-for-bit, then routes the pooled per-component RMSEP through n4m_metrics_one_se_rule_compute. We compare mean_rmse_per_component directly.

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✓ ref 4e-142.10 ms
Python · archived pls4all benchmark
pls4all.python✓ bind2.08 ms
pls4all.sklearn⇄ +9e-011.13 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ +9e-013.25 ms
pls4all.R.formula⇄ +9e-013.87 ms
pls4all.R.mdatools⇄ +9e-013.96 ms
pls4all.R.pls⇄ +9e-014.01 ms
R · external
📐ref.r_plssource11.6 ms
BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 4e-147.61 ms
Python · archived pls4all benchmark
pls4all.python✓ bind2.19 ms
pls4all.sklearn⇄ +9e-011.23 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ +9e-013.28 ms
pls4all.R.formula⇄ +9e-014.07 ms
pls4all.R.mdatools⇄ +9e-014.07 ms
pls4all.R.pls⇄ +9e-014.00 ms
R · external
📐ref.r_plssource11.6 ms
BackendParity200×30 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ ref 4e-142.06 ms
Python · archived pls4all benchmark
pls4all.python✓ bind2.14 ms
pls4all.sklearn⇄ +9e-011.13 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ +9e-012.80 ms
pls4all.R.formula⇄ +9e-015.64 ms
pls4all.R.mdatools⇄ +9e-014.37 ms
pls4all.R.pls⇄ +9e-014.60 ms
R · external
📐ref.r_plssource11.5 ms

See also: benchmark overview · methods index · interactive dashboard