Skip to content

Releases: rodrigo-arenas/Sklearn-genetic-opt

0.13.3

Choose a tag to compare

@rodrigo-arenas rodrigo-arenas released this 07 Jul 13:52
f3a3954

sklearn-genetic-opt 0.13.3

This release focuses on making search-space authoring easier, checkpointing safer, errors clearer, and the documentation/release flow cleaner.

Highlights

  • Search-space conversion helper: from_sklearn_space converts common RandomizedSearchCV-style spaces into native Integer, Continuous, and Categorical dimensions. It supports list-like categorical choices plus scipy.stats.randint, uniform, loguniform, and reciprocal frozen distributions.
  • Estimator presets: new starter spaces for RandomForestClassifier, RandomForestRegressor, HistGradientBoostingClassifier, HistGradientBoostingRegressor, LogisticRegression, SVC, XGBClassifier, and XGBRegressor. Presets support profile="fast", "balanced", or "wide" and a prefix argument for sklearn pipelines.
  • Checkpointing fixes: ModelCheckpoint and resume flows now build constructor-compatible estimator state more reliably, including GAFeatureSelectionCV support.
  • Better validation and error messages across search spaces, plotting helpers, callbacks, MLflow optional dependency handling, and scheduler adapters.
  • Docs cleanup: VitePress is now the single docs tree for generated images and release-facing docs.

New Features and Behavior

  • Added from_sklearn_space for converting sklearn/scipy-style search spaces into native sklearn-genetic-opt dimensions.
  • Added estimator preset helpers for common classifiers and regressors, including pipeline-friendly prefixes.
  • Added --use-cache / --no-use-cache to benchmarks/benchmark_fit.py, threading the option through GASearchCV and GAFeatureSelectionCV benchmark builders.
  • Added clearer successful-save output for ModelCheckpoint.
  • Improved internal score ranking utilities to handle NaN values consistently.

Bug Fixes

  • Fixed ModelCheckpoint state generation for GAFeatureSelectionCV and removed duplicate param_grid state.
  • Fixed random_state=0 handling for Integer and Continuous dimensions.
  • Fixed Categorical priors being ignored during sampling.
  • Fixed fitness cache restoration during checkpoint resume.
  • Fixed clearer validation for error_score during estimator construction.
  • Fixed and improved several plotting helper errors, including invalid top_k, unavailable metrics, unfitted estimators, and missing history fields.
  • Improved search-space validation for warm-start configs, unsupported scipy distributions, feature-name count mismatches, preset prefixes, and invalid param_grid entries.
  • Improved optional dependency messaging when MLflow is not installed.

Documentation and Maintenance

  • Added and expanded documentation for estimator presets, search-space conversion, pipeline preset prefixes, callbacks, troubleshooting, and community articles.
  • Added CITATION.cff and improved README citation guidance, including a BibTeX example.
  • Added internal Markdown link checking for versioned VitePress docs and root docs links.
  • Removed legacy docs/images duplication; generated figures now live under docs-vitepress/public/images.
  • Added pre-commit configuration for Black and basic hygiene checks.
  • Built and validated release artifacts with python -m build and twine check.

Installation

pip install -U sklearn-genetic-opt==0.13.3

Contributors

Huge thanks to everyone who contributed code, tests, docs, reviews, and release polish for this version:

@mayoka0, @delaidam, @kernelpanic888, @xuu33030, @cc1a2b, @andrianbalanesq, @Manabendu-ai, @milekv, @AndyDLi, @KingSylvan, @Ishita-Agrawal03, @isha-1686, @aastha-m22, @sarkarshrayan2-max, @ShiHuiwen-creat, @acm-rgb, and @jordansilly77-stack.

0.13.2

Choose a tag to compare

@rodrigo-arenas rodrigo-arenas released this 27 Jun 06:25
9ac47e9

Release Notes

0.13.2

Documentation release. No changes to the Python package.

New Documentation

New Guides

  • How Hyperparameter Optimization Works — complete conceptual guide comparing grid search, random search, Bayesian optimization, and genetic algorithms with worked Python examples and a method-selection flowchart.
  • Common Hyperparameter Tuning Mistakes — ten common pitfalls (data leakage, class imbalance, bad search spaces, missing seeds, premature stopping, and more) with diagnosis and fixes.
  • Choosing the Right Search Space — when to use Integer, Continuous, Categorical; when to use log-uniform; per-estimator recommended parameter ranges.
  • Feature Selection Methods Compared — side-by-side comparison of filter, embedded, and wrapper methods with guidance on when GAFeatureSelectionCV is the right choice.

New Tutorials

  • Random Forest Hyperparameter Tuning — 7-parameter joint search, which parameters matter most, classification and regression variants, baseline comparison.
  • Gradient Boosting Hyperparameter TuningHistGradientBoostingClassifier vs classic GradientBoostingClassifier, max_leaf_nodes vs max_depth, speed comparison.
  • Logistic Regression Hyperparameter Tuning — solver/penalty compatibility table, multi-penalty search with SAGA, mandatory scaling in a Pipeline.
  • SVM Hyperparameter Tuning (C, kernel, gamma) — C–gamma interaction visualization, mandatory Pipeline + StandardScaler, RBF vs linear kernel, O(n²) scaling note.

New Comparisons Section

  • Grid Search vs Random Search vs Bayesian vs Genetic Algorithms — honest equal-budget benchmark across all four methods with code and result tables.
  • Optuna vs sklearn-genetic-opt — head-to-head on tabular benchmarks using the Bayesmark experimental design; honest about where each approach wins.

New Recipes Section

A new Recipes section provides 30 copy-paste ready solutions (5–10 min each) organized into seven categories: Classification (8), Regression (5), Feature Selection (4), Pipelines (4), Scoring Metrics (5), Integrations (3), and Advanced (5).

See the full documentation for the complete recipe list.

Documentation Improvements

  • SEO titles and descriptions — titles on 15+ existing pages rewritten to answer the search query directly.
  • Cross-linking — "See Also" sections added to all tutorial and guide pages.
  • Difficulty and reading-time metadata — all tutorial pages now show difficulty level and an estimated reading time.
  • README — complete rewrite of README.rst as a high-converting GitHub landing page with value proposition, when-to-use / when-not-to-use guidance, a six-tool comparison table, condensed Quick Start, visual demo section, common use cases, and learning paths.

0.13.1

Choose a tag to compare

@rodrigo-arenas rodrigo-arenas released this 26 Jun 19:42
c13db3d

Release Notes

0.13.1

New Features

  • random_state parameter: GASearchCV and GAFeatureSelectionCV now accept a random_state argument that seeds the entire search at fit time — population initialisation (including Latin hypercube sampling), mutation, crossover, and random immigrants. Runs are fully reproducible without manually seeding the global random / numpy RNGs. Pass random_state=None (default) to keep the previous non-deterministic behaviour.

  • Expanded plotting API: eleven new functions in sklearn_genetic.plotsplot_parameter_evolution, plot_search_decisions, plot_candidate_scores, plot_feature_selection, plot_convergence, plot_diversity, plot_optimizer_events, plot_score_landscape, plot_cv_scores, plot_candidate_rankings, and plot_search_overview. See the Plotting Gallery for examples.

  • Benchmarks page: new Benchmarks section in the docs with Bayesmark-style comparisons of GASearchCV against Optuna and random search on tabular regression/classification tasks and CASH (combined algorithm selection and hyperparameter optimisation) scenarios.

Bug Fixes

  • Fixed Latin hypercube sampler reproducibility: the smart initialiser now seeds qmc.LatinHypercube from the global RNG so numeric-parameter searches are reproducible when random_state is set.

0.13.0

Choose a tag to compare

@rodrigo-arenas rodrigo-arenas released this 22 Jun 21:02
b31626e

sklearn-genetic-opt 0.13.0 — Release Notes

Release date: 22/06/2026
PyPI: pip install sklearn-genetic-opt==0.13.0
Docs: https://rodrigo-arenas.github.io/Sklearn-genetic-opt/versions/0.13/


Highlights

This is a major feature release that significantly expands the optimizer's quality and observability. The main themes are:

  • A cleaner API via grouped configuration objects (EvolutionConfig, PopulationConfig, RuntimeConfig, OptimizationConfig) that replace a growing flat list of keyword arguments.
  • Smarter search through a redesigned initialization strategy, uniform crossover, fitness sharing, local search, and final candidate re-evaluation.
  • Better population diversity management with diversity control now on by default and corrected probability defaults that better match standard GA practice.
  • Parallelism at the generation level, so unique candidates within a generation are evaluated in parallel rather than only within each CV fold.
  • Richer observability through the new fit_stats_ attribute and expanded per-generation telemetry in history.
  • MLflow 3 support and a redesigned documentation site (VitePress, replacing Sphinx/RTD).

Breaking Changes

Code that worked with 0.12.0 may need updates in the areas below.

Default probability values changed

crossover_probability and mutation_probability defaults have been swapped to align with standard evolutionary algorithm practice:

Parameter 0.12.0 default 0.13.0 default
crossover_probability 0.2 0.8
mutation_probability 0.8 0.1

Migration Guide

Minimal migration (no config objects)

Existing code that passes parameters directly still works. The only required changes are if you relied on the old default probabilities or the old diversity-control defaults:

# 0.12.0 code that relied on old defaults — must be made explicit in 0.13.0
GASearchCV(
    estimator=clf,
    param_grid=param_grid,
    crossover_probability=0.2,   # was the old default
    mutation_probability=0.8,    # was the old default
    diversity_control=False,     # was the old default
)

Recommended migration (config objects)

# 0.12.0
GASearchCV(
    estimator=clf,
    param_grid=param_grid,
    population_size=30,
    generations=20,
    crossover_probability=0.9,
    mutation_probability=0.05,
    n_jobs=-1,
    use_cache=True,
)

0.13.0 equivalent

GASearchCV(
estimator=clf,
param_grid=param_grid,
evolution_config=EvolutionConfig(
population_size=30,
generations=20,
crossover_probability=0.9,
mutation_probability=0.05,
),
runtime_config=RuntimeConfig(n_jobs=-1, use_cache=True),
)


Full Changelog

See the online changelog for the complete history of all versions.

# sklearn-genetic-opt 0.13.0 — Release Notes

Release date: 22/06/2026
PyPI: pip install sklearn-genetic-opt==0.13.0
Docs: https://rodrigo-arenas.github.io/Sklearn-genetic-opt/versions/0.13/


Highlights

This is a major feature release that significantly expands the optimizer's quality and
observability. The main themes are:

  • A cleaner API via grouped configuration objects (EvolutionConfig, PopulationConfig,
    RuntimeConfig, OptimizationConfig) that replace a growing flat list of keyword arguments.
  • Smarter search through a redesigned initialization strategy, uniform crossover,
    fitness sharing, local search, and final candidate re-evaluation.
  • Better population diversity management with diversity control now on by default and
    corrected probability defaults that better match standard GA practice.
  • Parallelism at the generation level, so unique candidates within a generation are
    evaluated in parallel rather than only within each CV fold.
  • Richer observability through the new fit_stats_ attribute and expanded per-generation
    telemetry in history.
  • MLflow 3 support and a redesigned documentation site (VitePress, replacing Sphinx/RTD).

Breaking Changes

Code that worked with 0.12.0 may need updates in the areas below.

Default probability values changed

crossover_probability and mutation_probability defaults have been swapped to align with
standard evolutionary algorithm practice:

Parameter 0.12.0 default 0.13.0 default
crossover_probability 0.2 0.8
mutation_probability 0.8 0.1

This applies to both GASearchCV and GAFeatureSelectionCV. If you relied on the old
defaults you must now pass them explicitly:

# Restore 0.12.0 behaviour
EvolutionConfig(crossover_probability=0.2, mutation_probability=0.8)

Diversity control is now enabled by default

diversity_control now defaults to True and diversity_threshold now defaults to 0.25
(previously False and 0.1 respectively). To restore the previous behaviour:

OptimizationConfig(diversity_control=False)

GASearchCV fitness function is now single-objective

Previously GASearchCV used a two-objective fitness that included a novelty_score based on
Hamming distance alongside the CV score. This caused Pareto-dominance comparisons to favour
diverse-but-lower-scoring candidates over strictly better ones, reducing search quality.

The fitness function is now single-objective (CV score only). Diversity is maintained
through dedicated mechanisms (fitness sharing, diversity control, random immigrants) that do
not corrupt the primary fitness signal.

GAFeatureSelectionCV is not affected — it retains its two-objective fitness
(CV score + feature count minimisation).

Minimum dependency versions raised

Package 0.12.0 minimum 0.13.0 minimum
Python 3.9 3.12
scikit-learn 1.5.0 1.9.0
NumPy 1.26.1 2.4.6
DEAP 1.3.3 1.4.4
tqdm 4.61.1 4.68.3
MLflow (opt) 2.20.0 3.14.0
TensorFlow (opt) 2.17.1 2.21.0
TensorBoard (opt) 2.20.0

New Features

Grouped configuration objects

Advanced settings are now organized into four dataclass-style objects, importable from
sklearn_genetic. The previous flat keyword arguments remain supported for backward
compatibility but the new objects are the recommended pattern.

from sklearn_genetic import (
    EvolutionConfig,
    PopulationConfig,
    RuntimeConfig,
    OptimizationConfig,
)

search = GASearchCV(
    estimator=clf,
    param_grid=param_grid,
    evolution_config=EvolutionConfig(population_size=30, generations=20),
    population_config=PopulationConfig(initializer="smart"),
    runtime_config=RuntimeConfig(n_jobs=-1, use_cache=True, parallel_backend="auto"),
    optimization_config=OptimizationConfig(fitness_sharing=True),
)

EvolutionConfig — population size, generations, crossover/mutation rates,
tournament size, elitism, hall-of-fame size, optimization criteria, and algorithm choice.

PopulationConfig — initialization strategy ("smart" or "random") and warm-start
seed configurations.

RuntimeConfig — parallelism (n_jobs, parallel_backend), evaluation caching,
verbosity, and train score reporting.

OptimizationConfig — diversity control, adaptive selection, fitness sharing, local
search, and final candidate re-evaluation.

Smart initialization (PopulationConfig(initializer="smart"))

The new default initialization strategy produces a better starting population by combining:

  • Latin hypercube sampling for numeric parameters to achieve even parameter-space coverage.
  • Estimator defaults — the first individual always includes the estimator's own default
    parameter values.
  • Warm-start seeds — explicit configs passed via warm_start_configs are injected into
    the initial generation.
  • Stratified categorical coverage — categorical values are cycled across the initial
    population to avoid over-sampling any single choice.
  • Duplicate avoidance — repeated individuals are replaced before the first generation begins.

Pass initializer="random" to revert to the previous behaviour.

Parallel candidate evaluation

Unique candidates within a generation are now de-duplicated and evaluated in parallel.
The parallel_backend parameter in RuntimeConfig controls the strategy:

Value Behaviour
"auto" Parallel across candidates; falls back gracefully
"population" Explicit parallel-across-candidates mode
"cv" Parallel within each candidate's CV folds

Note: If your estimator already uses internal parallelism (e.g., `RandomForestClassifier(n_jobs...

Read more

0.12.0

Choose a tag to compare

@rodrigo-arenas rodrigo-arenas released this 23 Jul 16:49
9641e53

This release includes:

Features:

  • Support for outlier detection algorithms, by @XBastille

Bug Fixes:

0.11.1

Choose a tag to compare

@rodrigo-arenas rodrigo-arenas released this 17 Sep 16:58
f9a643a

Bug Fixes:

  • Fixed a bug that would generate AttributeError: 'GASearchCV' object has no attribute 'creator'

0.11.0

Choose a tag to compare

@rodrigo-arenas rodrigo-arenas released this 12 Sep 23:26
1314a7c

Features:

  • Added a parameter use_cache, which defaults to True. When enabled, the algorithm will skip re-evaluating solutions that have already been evaluated, retrieving the performance metrics from the cache instead.
    If use_cache is set to False, the algorithm will always re-evaluate solutions, even if they have been seen before, to obtain fresh performance metrics.

  • Added a parameter in GAFeatureSelectionCV named warm_start_configs, which defaults to None. This is a list of predefined hyperparameter configurations to seed the initial population. Each element in the list is a dictionary where the keys are the names of the hyperparameters, and the values are the corresponding hyperparameter values to be used for the individual.

    Example:

    warm_start_configs = [
        {"min_weight_fraction_leaf": 0.02, "bootstrap": True, "max_depth": None, "n_estimators": 100},
        {"min_weight_fraction_leaf": 0.4, "bootstrap": True, "max_depth": 5, "n_estimators": 200},
    ]

The genetic algorithm will initialize part of the population with these configurations to warm-start the optimization process. The remaining individuals in the population will be initialized randomly according to the defined hyperparameter space.

This parameter is useful when prior knowledge of good hyperparameter configurations exists, allowing the algorithm to focus on refining known good solutions while still exploring new areas of the hyperparameter space. If set to None, the entire population will be initialized randomly.

  • Introduced a novelty search strategy to the GASearchCV class. This strategy rewards solutions that are more distinct from others in the population by incorporating a novelty score into the fitness evaluation. The novelty score encourages exploration and promotes diversity, reducing the risk of premature convergence to local optima.

    * Novelty Score: Calculated based on the distance between an individual and its nearest neighbors in the population. Individuals with higher novelty scores are more distinct from the rest of the population.
    
    * Fitness Evaluation: The overall fitness is now a combination of the traditional performance score and the novelty score, allowing the algorithm to balance between exploiting known good solutions and exploring new, diverse ones.
    
    * Improved Exploration: This strategy helps explore new areas of the hyperparameter space, increasing the likelihood of discovering better solutions and avoiding local optima.
    

API Changes:

  • Dropped support for Python 3.8

0.10.1

Choose a tag to compare

@rodrigo-arenas rodrigo-arenas released this 15 Mar 01:37
c04408d

This is a small release for a minor bug fix

Features:

  • Install TensorFlow when using pip install sklearn-genetic-opt[all]

Bug Fixes:

  • Fixed a bug that wouldn’t allow cloning the GA classes when used inside a pipeline

0.10.0

Choose a tag to compare

@rodrigo-arenas rodrigo-arenas released this 15 Feb 02:43
3afd98b

This release brings support to python 3.10, it also comes with different API updates and algorithms optimization

API Changes:

  • GAFeatureSelectionCV now mimics the scikit-learn FeatureSelection algorithms API instead of Grid Search, this enables easier implementation as a selection method that is closer to the scikit-learn API
  • Improved GAFeatureSelectionCV candidate generation when max_features is set, it also ensures there is at least one feature selected
  • crossover_probability and mutation_probability are now correctly passed to the mate and mutation functions inside GAFeatureSelectionCV
  • Dropped support for python 3.7 and add support for python 3.10
  • Update most important packages from dev-requirements.txt to more recent versions
  • Update deprecated functions in tests

Thanks to the people who contributed with their ideas and suggestions

0.9.0

Choose a tag to compare

@rodrigo-arenas rodrigo-arenas released this 06 Jun 22:46
5ca13c4

This release comes with new features and general performance improvements

Features:

  • Introducing Adaptive Schedulers to enable adaptive mutation and crossover probabilities; currently, supported schedulers are: ConstantAdapter, ExponentialAdapter, InverseAdapter, and PotentialAdapter

  • Add random_state parameter (default= None) in Continuous, Categorical and Integer classes from space to leave fixed the random seed during hyperparameters sampling.

API Changes:

  • Changed the default values of mutation_probability and crossover_probability to 0.8 and 0.2, respectively.

  • The weighted_choice function used in GAFeatureSelectionCV was re-written to give more probability to a number of features closer to the max_features parameter

  • Removed unused and broken function plot_parallel_coordinates()

Bug Fixes

  • Now, when using the plot_search_space() function, all the parameters get cast as np.float64 to avoid errors on the seaborn package while plotting bool values.