Skip to main content

sklearn-genetic-opt

sklearn-genetic-opt

Latest release on PyPI Continuous integration on master MIT license

Hyperparameter tuning and feature selection for scikit-learn. Give GASearchCV or GAFeatureSelectionCV a model, a scorer and a budget. The search evaluates candidates with cross-validation, refits the winner and lets you call predict on new data. Use it when the combinations of parameters or columns would make an exhaustive search too expensive.

Stable documentation · Backend tutorial · Benchmarks · Plot gallery

Which columns does the tree need?

Reuse the model, folds and budget with GAFeatureSelectionCV. Set an upper limit of eight columns. The fitted selector applies its mask during prediction.

from sklearn_genetic import GAFeatureSelectionCV

selector = GAFeatureSelectionCV(tree, max_features=8, **settings).fit(X_train, y_train)
print(selector.get_support(indices=True))
print(balanced_accuracy_score(y_test, selector.predict(X_test)))

Choose an optimizer

DEAP is included by default. Four additional engines are available as extras. Install the extra for the engine you want. For example, to use pymoo:

python -m pip install "sklearn-genetic-opt[pymoo]>=0.16.0"

Change one parameter on either estimator to run the same experiment with a different engine. Cloning keeps the earlier result available for comparison.

from sklearn.base import clone

alternative = clone(selector).set_params(optimizer_backend="pymoo")
alternative.fit(X_train, y_train)
print(alternative.get_support(indices=True), alternative.fit_stats_["cross_validate_calls"])

Backend

What it brings to the search

deap

Included by default. Choose genetic operators, adaptive schedules and local search.

scipy

Differential evolution for bounded spaces. It can stop early when the population converges.

nevergrad

OnePlusOne adjusts its mutations as candidates succeed or fail. TwoPointsDE is also available.

cmaes

CatCMA with Margin learns how numeric variables vary together and adapts category probabilities.

pymoo

Uses type-specific operators for mixed parameters and a binary genetic algorithm for feature masks.

Each optional engine has a pip extra with the same name. All five support live plotting, early stopping and resuming from a completed generation. The engine reference lists supported domains, controls and checkpoint requirements. To integrate another optimizer, see the plugin protocol.

How do they compare? The benchmarks compare the bundled optimizers at matched counts of fresh CV calls, using separate held-out scores. No single engine wins on every workload; choose the search space, metric and budget before comparing engines on your own data.

What changed in 0.17.0

  • Cap new cross-validation calls with CVBudgetStopping and see fresh, reused and refit work separately in fit_counts_. The budget and resume tutorial shows how to save work across sessions.

  • Keep pandas column names and dtypes in feature selection with preserve_dataframe=True, or seed the search using PopulationConfig(warm_start_masks=...).

  • Diagnose a run with per-fold and finalist score plots, phase timings and clearer errors for invalid folds, failed fits and unreadable checkpoints.

Go further

Cite sklearn-genetic-opt

If you use the library in research, cite the version used in your experiment. For version 0.17.0, cite Rodrigo Arenas (2026), sklearn-genetic-opt (version 0.17.0) [Computer software]. The software citation contains the machine-readable metadata. For BibTeX, use:

@software{arenas2026sklearn_genetic_opt,
  author  = {Arenas, Rodrigo},
  title   = {{sklearn-genetic-opt}},
  year    = {2026},
  version = {0.17.0},
  url     = {https://pypi.org/project/sklearn-genetic-opt/0.17.0/}
}

Metadata

Release files for sklearn-genetic-opt 0.17.0

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

Source distribution (sdist)

Source distribution for sklearn-genetic-opt 0.17.0
File Size Uploaded Provenance Actions
sklearn_genetic_opt-0.17.0.tar.gz 150.6 kB With provenance Details for sklearn_genetic_opt-0.17.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sklearn-genetic-opt 0.17.0
File Interpreter ABI Platform Actions
sklearn_genetic_opt-0.17.0-py3-none-any.whl Python 3 none any Details for sklearn_genetic_opt-0.17.0-py3-none-any.whl

Total release size: 314.8 kB

Release files / sklearn_genetic_opt-0.17.0.tar.gz

Download URL sklearn_genetic_opt-0.17.0.tar.gz
Size 150.6 kB
Tags Source
SHA-256 checksum
How to use checksums
99600554e33b7b274896f919ff8aeb4b46961dd96ed27c4dad14f7eda2fe8513
BLAKE2b-256 checksum
How to use checksums
8fa36827bdfca669e278c994111c9c7ee495bf3d35d60f108f5ea517b1c93c65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Release files / sklearn_genetic_opt-0.17.0-py3-none-any.whl

Download URL sklearn_genetic_opt-0.17.0-py3-none-any.whl
Size 164.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
799798c24aadbcff611f512b504383d47b4693b430f24c1551517c755bba292c
BLAKE2b-256 checksum
How to use checksums
45f932231102858e81e25dd7035f7261a1df7c5c182476252b4ad4c7a13aed61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Security for sklearn-genetic-opt 0.17.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sklearn_genetic_opt-0.17.0.tar.gz

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 Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.17.0 This release

2 release files Full provenance

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