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_plsgenetic-algorithm variable selection. Default_ga_select_pls4allpath 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 vialegacy=True.
Parameters¶
Name |
Type |
Default |
Notes |
|---|---|---|---|
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
current public binding signature |
|
|
|
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) —plsVarSel0.10.0 · strict (rmse_rel ≤ 1e-06) — RplsVarSel::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.
| Backend | Parity | 200×40 (ms) |
|---|---|---|
| C++ native · libn4m | ||
pls4all.cpp.blas+omp | ✓ J 1.00 | 607.6 ms |
| Python · archived pls4all benchmark | ||
pls4all.python | ✓ J 1.00 | 756.5 ms |
pls4all.sklearn | ⇄ J 0.32 | 3.94 ms🏆 |
| R · archived pls4all benchmark | ||
pls4all.R | ⇄ J 0.32 | 7.38 ms |
pls4all.R.formula | ⇄ J 0.32 | 8.59 ms |
pls4all.R.mdatools | ⇄ J 0.32 | 16.0 ms |
pls4all.R.pls | ⇄ J 0.32 | 9.76 ms |
| R · external | ||
📐ref.r_plsvarsel | source | 218.7 ms |
| Backend | Parity | 200×40 (ms) |
|---|---|---|
| C++ native · libn4m | ||
pls4all.cpp.blas+omp | ✓ J 1.00 | 628.1 ms |
| Python · archived pls4all benchmark | ||
pls4all.python | ✓ J 1.00 | 600.8 ms |
pls4all.sklearn | ⇄ J 0.32 | 3.94 ms🏆 |
| R · archived pls4all benchmark | ||
pls4all.R | ⇄ J 0.32 | 7.17 ms |
pls4all.R.formula | ⇄ J 0.32 | 7.95 ms |
pls4all.R.mdatools | ⇄ J 0.32 | 8.10 ms |
pls4all.R.pls | ⇄ J 0.32 | 8.03 ms |
| R · external | ||
📐ref.r_plsvarsel | source | 425.9 ms |
| Backend | Parity | 200×40 (ms) |
|---|---|---|
| C++ native · libn4m | ||
pls4all.cpp.blas+omp | ✓ J 1.00 | 626.6 ms |
| Python · archived pls4all benchmark | ||
pls4all.python | ✓ J 1.00 | 1.8 s |
pls4all.sklearn | ⇄ J 0.32 | 3.88 ms🏆 |
| R · archived pls4all benchmark | ||
pls4all.R | ⇄ J 0.32 | 7.01 ms |
pls4all.R.formula | ⇄ J 0.32 | 7.86 ms |
pls4all.R.mdatools | ⇄ J 0.32 | 7.57 ms |
pls4all.R.pls | ⇄ J 0.32 | 7.89 ms |
| R · external | ||
📐ref.r_plsvarsel | source | 226.4 ms |
See also: benchmark overview · methods index · interactive dashboard