Skip to content

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=-1)), set parallel_backend="cv" or fix the estimator's n_jobs=1 to avoid CPU oversubscription.

fit_stats_ attribute

A new dictionary attribute exposed after fit() provides evaluation accounting:

search.fit(X_train, y_train)
print(search.fit_stats_)
# {
#   "evaluated_candidates": 340,
#   "unique_candidates": 285,
#   "cross_validate_calls": 855,
#   "cache_hits": 55,
#   "duplicate_candidates": 55,
#   "skipped_invalid_candidates": 2,
#   "random_immigrants": 12,
#   "local_refinement_candidates": 3,
# }

Expanded history telemetry

Per-generation entries in history now include additional fields:

New field Description
genotype_diversity Fraction of distinct genotypes in the population
unique_individual_ratio Ratio of unique individuals to population size
fitness_best Best fitness value in that generation
stagnation_generations Number of consecutive generations without improvement
diversity_control_triggered Whether diversity intervention fired that generation

Uniform crossover for GASearchCV

GASearchCV now applies cxUniform (50 % per-gene swap probability) instead of two-point
crossover. Uniform crossover is better suited to mixed-type hyperparameter spaces where
parameters are not laid out in a meaningful positional order.

Local search (OptimizationConfig(local_search=True))

After the genetic phase, a short neighbourhood search refines the top hall-of-fame candidates
by evaluating nearby parameter configurations. Controlled by local_search_top_k,
local_search_steps, and local_search_radius.

Fitness sharing (OptimizationConfig(fitness_sharing=True))

Applies niche-aware selection: individuals that are too similar to other high-scoring
candidates have their effective fitness reduced, promoting exploration of distinct regions
of the search space. Controlled by sharing_radius and sharing_alpha.

Adaptive tournament selection (adaptive_selection=True)

Tournament size adjusts automatically based on current population diversity and stagnation
count: higher pressure when the search is healthy, lower pressure when diversity drops.
Controlled via selection_pressure_min, selection_pressure_max, and
offspring_diversity_retries in OptimizationConfig.

Final candidate re-evaluation (final_selection=True)

After the GA completes, the top-K candidates are re-evaluated (optionally with a different CV
strategy) and the best-scoring one is selected before the final refit. Useful when noise in
CV scores may have elevated a slightly weaker candidate to the hall of fame.

Compact generation log

When verbose=1, the per-generation log now shows div, unique, stag, and events
columns alongside the fitness summary, providing at-a-glance diversity diagnostics without
additional configuration.

Expanded plotting helpers

  • plot_fitness_evolution — supports multiple metrics and optional smoothing.
  • plot_history — can visualize any arbitrary telemetry field from history.
  • plot_search_space — adds pair-plot mode and a correlation heatmap between parameters
    and CV score.

MLflow 3 support

The MLflowConfig integration is updated to MLflow ≥ 3.14.0. The logging interface is
unchanged; only the dependency version floor was raised.


Bug Fixes

  • Fixed fitted estimator persistence by excluding volatile DEAP runtime objects from the
    saved state. Previously, serializing a fitted GASearchCV with pickle could fail or
    produce oversized files.
  • Fixed type preservation for hyperparameter candidates across all population operations.
    Integer parameters could previously drift to float in some crossover paths.
  • Fixed smart feature-selection initialization in GAFeatureSelectionCV to respect
    max_features and always include at least one selected feature in the initial population.
  • Fixed convergence telemetry so that local refinement results are reflected in the final
    generation's history row rather than being silently dropped.

Dependency Updates

Package Old requirement New requirement
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
Seaborn (opt) ≥ 0.11.2 ≥ 0.13.2
MLflow (opt) ≥ 2.20.0 ≥ 3.14.0
TensorFlow (opt) ≥ 2.17.1 ≥ 2.21.0
TensorBoard (opt) ≥ 2.20.0

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](https://rodrigo-arenas.github.io/Sklearn-genetic-opt/versions/0.13/release-notes.html)
for the complete history of all versions.