Skip to main content

Genetic Algorithm Feature Selector — a scikit-learn-compatible wrapper feature selector for tabular data (evo-suite)

Project description

evo-gafs — Genetic Algorithm Feature Selector

License: MIT

A scikit-learn-compatible wrapper feature selector for tabular data, powered by DEAP. evo-gafs searches for the subset of features that maximises a cross-validated score of your model, and lets you explicitly trade raw performance for a smaller feature set — useful for edge deployment.

Part of the evo-suite family (import name: evo_gafs).

Why evo-gafs?

Capability evo-gafs
Single-objective weighted fitness with a configurable alpha (performance ↔ compression)
Multi-objective NSGA-II with an accessible Pareto front
Repair operator guaranteeing a minimum number of features
Evaluation cache to skip repeated genomes
Native scikit-learn fit/transform/get_support, usable in a Pipeline
Built-in multi-dataset BenchmarkRunner

Installation

pip install evo-gafs            # core
pip install evo-gafs[viz]       # + matplotlib for the plotting helpers

Quickstart

from sklearn.datasets import load_breast_cancer
from sklearn.tree import DecisionTreeClassifier
from evo_gafs import GAFeatureSelector, GAConfig

X, y = load_breast_cancer(return_X_y=True, as_frame=True)

selector = GAFeatureSelector(
    estimator=DecisionTreeClassifier(random_state=42),
    config=GAConfig(population_size=30, n_generations=20, alpha=0.8, verbose=False),
)
selector.fit(X, y)

print(selector.summary())
X_reduced = selector.transform(X)
print("Selected:", selector.get_support(indices=True))

Multi-objective (Pareto front)

config = GAConfig(mode="multiobjective", population_size=40, n_generations=30, verbose=False)
selector = GAFeatureSelector(estimator=DecisionTreeClassifier(random_state=42), config=config)
selector.fit(X, y)

for point in selector.result_.pareto_front:
    print(point["n_features"], point["cv_score"])

In a scikit-learn pipeline

from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC

pipe = Pipeline([
    ("scaler", StandardScaler()),
    ("selector", GAFeatureSelector(estimator=DecisionTreeClassifier(), config=config)),
    ("clf", SVC()),
])
pipe.fit(X, y)

The alpha trade-off (single-objective)

fitness = alpha * cv_score + (1 - alpha) * compression
compression = 1 - n_selected / n_total
  • alpha = 1.0 → pure wrapper (performance only)
  • alpha ≈ 0.7 → balanced, good default for edge deployment

Citation

@software{evo_gafs,
  author    = {Skrauba, Axel},
  title     = {evo-gafs: Genetic Algorithm Feature Selector for tabular data},
  year      = {2026},
  version   = {0.1.0},
  url       = {https://github.com/AxelSkrauba/evo-suite}
}

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evo_gafs-0.1.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evo_gafs-0.1.0-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file evo_gafs-0.1.0.tar.gz.

File metadata

  • Download URL: evo_gafs-0.1.0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for evo_gafs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0dd1af5f6d832a163f0e7aa64234f98660ef1d6383d7f24848506f4e903f19f4
MD5 4c20292ff57d70f87f725c0355d5acbb
BLAKE2b-256 0543ff063662d2f9f5e3652b041b1caf6081dedda0830d77a9777deeef99aabd

See more details on using hashes here.

Provenance

The following attestation bundles were made for evo_gafs-0.1.0.tar.gz:

Publisher: publish.yml on AxelSkrauba/evo-suite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file evo_gafs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: evo_gafs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for evo_gafs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68a56fb9a2e1bf924ae01187f05e5b826f918af61f967ec66b602080aea82d65
MD5 81e71755a8a89b76618af98c65b9301a
BLAKE2b-256 ef58cca906a1ecfd8b663fd432af35feb7e7383344dc811c01421fe4e2f9a7b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for evo_gafs-0.1.0-py3-none-any.whl:

Publisher: publish.yml on AxelSkrauba/evo-suite

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page