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.18.0

  • Tune transformers and clusterers inside scikit-learn pipelines. A searched target encoder keeps its native cross-fitting on training rows.

  • Use preserve_dataframe="align_named_columns" to select features with named column preprocessors, including inside nested searches.

  • Explore positive integer parameters with distribution="log-uniform". DEAP can use optional retries to explore more distinct candidates at a fixed evaluation budget. See the release notes for the measured results.

Go further

Cite sklearn-genetic-opt

If you use the library in research, cite the version used in your experiment. For version 0.18.0, cite Rodrigo Arenas (2026), sklearn-genetic-opt (version 0.18.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.18.0},
  url     = {https://pypi.org/project/sklearn-genetic-opt/0.18.0/}
}

Metadata

Release files for sklearn-genetic-opt 0.18.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.18.0
File Size Uploaded Provenance Actions
sklearn_genetic_opt-0.18.0.tar.gz 173.5 kB With provenance Details for sklearn_genetic_opt-0.18.0.tar.gz

Built distribution (wheel)

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

Total release size: 360.6 kB

Release files / sklearn_genetic_opt-0.18.0.tar.gz

Download URL sklearn_genetic_opt-0.18.0.tar.gz
Size 173.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c241bd48d8fad7edffc3d1b37103298b8360b8b9d0699012c4a9b4927ba6f4c3
BLAKE2b-256 checksum
How to use checksums
a7f5da6596a279210c56be793b3ffae646cf22748ae1a561409355ec28559855
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 29, 2026.

Transparency log

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

Download URL sklearn_genetic_opt-0.18.0-py3-none-any.whl
Size 187.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
466c349f539a217d2827d71ef8949a59e90accb0bdb76eb77e079f0a280f43d0
BLAKE2b-256 checksum
How to use checksums
364c7e2611b1dec56845b4e4667f8b52f97ace5c6918816995152c76ea1c5c4e
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 29, 2026.

Transparency log

Security for sklearn-genetic-opt 0.18.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.18.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 29, 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.18.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