Skip to main content

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

Metadata

Release files for evo-gafs 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for evo-gafs 0.1.1
File Size Uploaded
evo_gafs-0.1.1.tar.gz 22.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for evo-gafs 0.1.1
File Interpreter ABI Platform
evo_gafs-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 50.2 kB

Release files / evo_gafs-0.1.1.tar.gz

Download URL evo_gafs-0.1.1.tar.gz
Size 22.7 kB
Tags Source
SHA-256 checksum
How to use checksums
35b46cb605609c8dd46ee955d87a1e1901f07d9603c414e19a4b6c38209b6979
BLAKE2b-256 checksum
How to use checksums
e24cbfeb3e6293457da13d0c02dce32b097c45bb114c29f729c1c011e4d0a1fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.

Transparency log

Release files / evo_gafs-0.1.1-py3-none-any.whl

Download URL evo_gafs-0.1.1-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2812b797a301dc2ad58ba90e997ba588f3befd45cee2d4a81784403db3186f7
BLAKE2b-256 checksum
How to use checksums
ff519f9e8b0a4a2947c25337935ac9af98ad3379c2f25959143f1cf905b4e711
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page