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

PyPI Python versions Docs CI 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). 📖 Documentation: https://evo-suite.readthedocs.io/

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

Documentation & examples

Citation

@software{evo_gafs,
  author    = {Skrauba, Axel},
  title     = {evo-gafs: Genetic Algorithm Feature Selector for tabular data},
  year      = {2026},
  version   = {0.1.1},
  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.1.tar.gz (22.7 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.1-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: evo_gafs-0.1.1.tar.gz
  • Upload date:
  • Size: 22.7 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.1.tar.gz
Algorithm Hash digest
SHA256 35b46cb605609c8dd46ee955d87a1e1901f07d9603c414e19a4b6c38209b6979
MD5 199ff45d6219c75c2e0589185e499cfc
BLAKE2b-256 e24cbfeb3e6293457da13d0c02dce32b097c45bb114c29f729c1c011e4d0a1fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for evo_gafs-0.1.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: evo_gafs-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c2812b797a301dc2ad58ba90e997ba588f3befd45cee2d4a81784403db3186f7
MD5 a36dfa657e256b27160fd3c51a4c71c3
BLAKE2b-256 ff519f9e8b0a4a2947c25337935ac9af98ad3379c2f25959143f1cf905b4e711

See more details on using hashes here.

Provenance

The following attestation bundles were made for evo_gafs-0.1.1-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