ga_select — GA-PLS — Genetic Algorithm variable selection

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

Description

GA-PLS genetic algorithm selection

Registry note — R plsVarSel::ga_pls genetic-algorithm variable selection. Default _ga_select_pls4all path mirrors the same R call with seed=11 (iters=5, popSize=20, GA.threshold=3), giving bit-exact mask parity. The C++ splitmix64 GA kernel is opt-in via legacy=True.

Parameters

Name

Type

Default

Notes

n_components

int

2

current public binding signature

n_generations

int

30

current public binding signature

population_size

int

40

current public binding signature

min_features

int | None

None

current public binding signature

max_features

int | None

None

current public binding signature

mutation_rate

float

0.05

current public binding signature

n_folds

int

3

current public binding signature

seed

int

0

current public binding signature

Explanations

Bibliographic source

Leardi, R. (2000). Application of genetic algorithm–PLS for feature selection in spectral data sets. Journal of Chemometrics 14(5–6), 643–655. Verified primary link: https://doi.org/10.1002/1099-128X(200009/12)14:5/6%3C643::AID-CEM621%3E3.0.CO;2-E.

Mathematical principle

Wrap a binary genetic algorithm around PLS CV-RMSE. Each chromosome is a \(p\)-bit binary mask encoding which features to include; fitness is \(-\mathrm{CV\text{-}RMSE}\) from PLS on the masked subset; standard GA operators (single-point crossover, bit-flip mutation, elitism) drive the population.

Cost is high — every fitness evaluation is a full PLS fit — but GA-PLS handles non-convex fitness landscapes (non-additive interactions between selected features) that greedy methods miss. Recommended population sizes: 30–100; generations: 100–500.

Stochastic by construction: results vary across RNG seeds. For deterministic comparisons against this selector the benchmark widens the parity tolerance and fixes the seed; in production use a small ensemble of GA runs and take the consensus.

Appropriate uses

Combinatorial wavelength-subset search with crossover and mutation under a PLS fitness score.

Limits and validation

The stochastic search can converge prematurely and heavily reuses the fitness data; population size and seed affect results.

Implementation

n4m_feature_selection_ga_select. Reference: R plsVarSel.

Sources and provenance

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

API and bindings

C ABI (ABI 2): n4m_feature_selection_ga_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 GA

Source signature: GA(*, n_components: int = 2, n_generations: int = 30, population_size: int = 40, min_features: int | None = None, max_features: int | None = None, mutation_rate: float = 0.05, n_folds: int = 3, seed: int = 0) (n4m/_impl/selection.py).

R (source-verified): ga_select(X, Y, n_components, n_generations = 50L, population_size = 50L, min_features = NULL, max_features = NULL, mutation_rate = 0.01, seed = 0L).

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

MATLAB / Octave (source-verified): ga_select(X, Y, n_components, n_generations, population_size, ... min_features, max_features, mutation_rate, seed).

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 · strict (rmse_rel ≤ 1e-06) — R plsVarSel::ga_pls — genetic-algorithm variable selection. RNG differs from pls4all’s GA so set overlap is loose.

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.00607.6 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.00756.5 ms
pls4all.sklearn⇄ J 0.323.94 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ J 0.327.38 ms
pls4all.R.formula⇄ J 0.328.59 ms
pls4all.R.mdatools⇄ J 0.3216.0 ms
pls4all.R.pls⇄ J 0.329.76 ms
R · external
📐ref.r_plsvarselsource218.7 ms
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ J 1.00628.1 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.00600.8 ms
pls4all.sklearn⇄ J 0.323.94 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ J 0.327.17 ms
pls4all.R.formula⇄ J 0.327.95 ms
pls4all.R.mdatools⇄ J 0.328.10 ms
pls4all.R.pls⇄ J 0.328.03 ms
R · external
📐ref.r_plsvarselsource425.9 ms
BackendParity200×40 (ms)
C++ native · libn4m
pls4all.cpp.blas+omp✓ J 1.00626.6 ms
Python · archived pls4all benchmark
pls4all.python✓ J 1.001.8 s
pls4all.sklearn⇄ J 0.323.88 ms🏆
R · archived pls4all benchmark
pls4all.R⇄ J 0.327.01 ms
pls4all.R.formula⇄ J 0.327.86 ms
pls4all.R.mdatools⇄ J 0.327.57 ms
pls4all.R.pls⇄ J 0.327.89 ms
R · external
📐ref.r_plsvarselsource226.4 ms

See also: benchmark overview · methods index · interactive dashboard