t2_select — Hotelling T² loading selection

Group: Variable selector · Registry tolerance: 2.0

Description

T²-PLS loading-weight selection (§18 Phase 5l)

Registry note — R plsVarSel::T2_pls (Mehmood 2016) Hotelling-T² loading-weight selection, called with train=test so it matches pls4all’s single-training-set selector. VERIFIED IDENTICAL where it matters: pls4all’s per-feature T², the UCL = ((p-1)^2/p)*qbeta(1-alpha, a/2, (p-a-1)/2), the sample covariance over features (/(p-1)), the t2>ucl threshold, the top-k floor fallback, and the min-CV-error alpha pick are all bit-identical to plsVarSel t2_calc / T2_pls. The residual mask divergence is an UPSTREAM PLS loading-weight convention difference: plsVarSel computes T² from R pls::plsr loading.weights (== sklearn x_weights_), while pls4all computes T² from the fitted model’s weights_w; on borderline features near the UCL the two select slightly different sets (Jaccard ~0.7–1.0; both capture the true signal). Both are valid T²-PLS selectors. Gated on Jaccard via the orchestrator SELECTION_DIVERGENCE_ALLOWLIST.

Parameters

Name

Type

Default

Notes

alpha_thresholds

—

required

current public binding signature

n_components

int

2

current public binding signature

min_selected

int | None

None

current public binding signature

Explanations

Bibliographic source

Mehmood, T. (2016). Hotelling T² based variable selection in partial least squares regression. Chemometrics and Intelligent Laboratory Systems 154, 23–28. https://doi.org/10.1016/j.chemolab.2016.03.020 — proposes T²-PLS, the loading-weights-level Hotelling T² selector. See also Wold, Sjöström & Eriksson (2001), Chemometrics and Intelligent Laboratory Systems 58(2), 109–130 §6.2 for the original T²-vs-VIP discussion in PLS.

Mathematical principle

The routine derives a variable statistic from PLS weight contributions and compares it with a cutoff based on a Beta quantile \(B_{1-\alpha}(a/2,(p-a-1)/2)\) and factor \((p-1)^2/p\). Variables above the cutoff are selected; the highest statistics fill any min_selected shortfall. It repeats this process for each supplied alpha, evaluates a PLS cross-validation fit for every resulting subset, and reports both selected_indices_best_error (smallest CV RMSE) and selected_indices_min_set (fewest variables, then CV-RMSE tie-break).

Appropriate uses

Screening variables by their contribution to leverage in the implemented PLS weight space.

Limits and validation

The cutoff uses a Beta quantile with an implementation-specific weight-based statistic, not the archived F-limit/top-k algorithm; min_selected may add variables.

Implementation

This is not the F control-limit plus top-k procedure formerly documented. Beta-quantile parameter validity and the fallback selected count depend on p and a; alpha selection and its CV must be performed inside an outer validation loop to avoid selection leakage.

Sources and provenance

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

API and bindings

C ABI (ABI 2): n4m_feature_selection_t2_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 T2

Source signature: T2(alpha_thresholds, *, n_components: int = 2, min_selected: int | None = None) (n4m/_impl/selection.py).

R (source-verified): t2_select(X, Y, n_components, alpha_thresholds, min_selected = NULL).

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

MATLAB / Octave (source-verified): t2_select(X, Y, n_components, alpha_thresholds, min_selected).

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 · qualitative (rmse_rel ≤ 2e+00) — R plsVarSel::T2_pls — Hotelling T² loading-weight selection. Same idea as pls4all’s T2_select.

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: qualitative — shape/smoke comparison only. The external library and archived benchmark harness do not produce numerically equivalent output for this method (see the MethodSpec notes); the rmse_rel_tol ≤ 2e+00 budget is set wide on purpose. Treat ~ shape as “we ran both, both finished”, not as numerical agreement.

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 0.801.67 ms🏆
Python · archived pls4all benchmark
pls4all.python✓ J 0.801.69 ms
pls4all.sklearn✓ J 0.801.83 ms
R · archived pls4all benchmark
pls4all.R✓ J 0.804.21 ms
pls4all.R.formula✓ J 0.806.34 ms
pls4all.R.mdatools✓ J 0.806.75 ms
pls4all.R.pls✓ J 0.805.80 ms
R · external
📐ref.r_plsvarselsource37.0 ms
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp⇄ J 0.801.67 ms🏆
Python · archived pls4all benchmark
pls4all.python✓ J 0.801.69 ms
pls4all.sklearn✓ J 0.801.89 ms
R · archived pls4all benchmark
pls4all.R✓ J 0.805.03 ms
pls4all.R.formula✓ J 0.805.50 ms
pls4all.R.mdatools✓ J 0.805.35 ms
pls4all.R.pls✓ J 0.805.34 ms
R · external
📐ref.r_plsvarselsource35.9 ms
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp⇄ J 0.801.66 ms🏆
Python · archived pls4all benchmark
pls4all.python✓ J 0.801.76 ms
pls4all.sklearn✓ J 0.801.83 ms
R · archived pls4all benchmark
pls4all.R✓ J 0.804.63 ms
pls4all.R.formula✓ J 0.805.24 ms
pls4all.R.mdatools✓ J 0.805.78 ms
pls4all.R.pls✓ J 0.805.58 ms
R · external
📐ref.r_plsvarselsource35.4 ms

See also: benchmark overview · methods index · interactive dashboard