randomization_select — Randomisation test (Y-permutation)

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

Description

Randomization-test selector (§18 Phase 5o)

Registry note — Base R: SIMPLS coefs vs permuted-Y null distribution. Default _randomization_select_pls4all path mirrors the same base-R permutation test with seed=randomization_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_permutations

int

200

current public binding signature

randomization_seed

int

0

current public binding signature

alpha

float

0.05

current public binding signature

Explanations

Bibliographic source

Westad, F. & Martens, H. (2000). Variable selection in near infrared spectroscopy based on significance testing in partial least squares regression. JNIRS 8(2), 117–124. Verified primary link: https://doi.org/10.1255/jnirs.271.

Mathematical principle

For each variable, response permutations form a null distribution of its association score. The Monte Carlo p-value includes the usual finite-permutation correction, and the implementation retains variables whose p-value is less than or equal to alpha.

Appropriate uses

Permutation testing of individual wavelength association under a specified exchangeability null.

Limits and validation

Current selection uses p <= alpha without multiplicity correction; Benjamini–Hochberg is only a recommendation, not implemented.

Implementation

The selector applies the unadjusted per-variable cutoff p <= alpha. False-discovery-rate control such as Benjamini–Hochberg is scientifically advisable for many simultaneous tests but is not implemented here.

Sources and provenance

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

API and bindings

C ABI (ABI 2): n4m_feature_selection_randomization_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 Randomization

Source signature: Randomization(*, n_components: int = 2, n_permutations: int = 200, randomization_seed: int = 0, alpha: float = 0.05) (n4m/_impl/selection.py).

R (source-verified): randomization_select(X, Y, n_components, n_permutations = 100L, randomization_seed = 0L, alpha = 0.05).

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

MATLAB / Octave (source-verified): randomization_select(X, Y, n_components, n_permutations, ... randomization_seed, alpha).

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

Registry parity references 📐

  • 📐 ref.r_pls_stats (R · r) — pls+stats R 4.3.3 · strict (rmse_rel ≤ 1e-06) — Base R: SIMPLS coefficients vs permuted-Y null distribution. Selects features with empirical p-value < alpha. Same idea as pls4all’s randomization_test selector.

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.00181.1 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.00182.5 ms
pls4all.sklearn✓ J 1.002.67 ms🏆
R · archived pls4all benchmark
pls4all.R✓ J 1.006.34 ms
pls4all.R.formula✓ J 1.005.94 ms
pls4all.R.mdatools✓ J 1.006.29 ms
pls4all.R.pls✓ J 1.006.80 ms
R · external
📐ref.r_pls_statssource54.5 ms
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ J 1.00187.4 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.00190.6 ms
pls4all.sklearn✓ J 1.002.80 ms🏆
R · archived pls4all benchmark
pls4all.R✓ J 1.006.12 ms
pls4all.R.formula✓ J 1.006.58 ms
pls4all.R.mdatools✓ J 1.006.46 ms
pls4all.R.pls✓ J 1.006.95 ms
R · external
📐ref.r_pls_statssource57.0 ms
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ J 1.00222.2 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.00218.8 ms
pls4all.sklearn✓ J 1.002.78 ms🏆
R · archived pls4all benchmark
pls4all.R✓ J 1.006.42 ms
pls4all.R.formula✓ J 1.006.83 ms
pls4all.R.mdatools✓ J 1.007.18 ms
pls4all.R.pls✓ J 1.007.31 ms
R · external
📐ref.r_pls_statssource56.8 ms

See also: benchmark overview · methods index · interactive dashboard