Skip to main content

sklearn-genetic-opt

sklearn-genetic-opt

Latest release on PyPI Continuous integration on master MIT license

Tune a scikit-learn estimator or find a smaller set of features. Give the search a model, a scorer and a budget. It 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

Version 0.16.0 includes DEAP by default and supports four optional engines. 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? Across five held-out splits, pymoo had the lowest mean RMSE on both synthetic linear-regression feature-selection tasks. DEAP had the lowest mean RMSE when tuning a tree on Friedman #1. The benchmarks compare nine workloads at matched counts of actual CV calls and include overhead, raw measurements and commands to reproduce the runs.

Go further

Cite sklearn-genetic-opt

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

Metadata

Release files for sklearn-genetic-opt 0.16.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.16.0
File Size Uploaded Provenance Actions
sklearn_genetic_opt-0.16.0.tar.gz 104.4 kB With provenance Details for sklearn_genetic_opt-0.16.0.tar.gz

Built distribution (wheel)

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

Total release size: 220.7 kB

Release files / sklearn_genetic_opt-0.16.0.tar.gz

Download URL sklearn_genetic_opt-0.16.0.tar.gz
Size 104.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9761001dffbf2d6fc53d96d71a9c0fefa0471b029685bbabafa7d6f0f3633062
BLAKE2b-256 checksum
How to use checksums
c8689d4e3c25b8970af0b1a67cb43c49760f13f1ea2eec7bf71fa99919dc8321
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 21, 2026.

Transparency log

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

Download URL sklearn_genetic_opt-0.16.0-py3-none-any.whl
Size 116.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94ea157755951c2b169edf43ee29503c0c5421f39b27507d9293472899c2a0e5
BLAKE2b-256 checksum
How to use checksums
827b77bb05e04814b9f66242afa46ef882a472e440978bb5be39d701f4042f19
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 21, 2026.

Transparency log

Security for sklearn-genetic-opt 0.16.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.16.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 21, 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.16.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