optuna.samplers.nsgaii.SBXCrossover
- class optuna.samplers.nsgaii.SBXCrossover(eta=None, uniform_crossover_prob=0.5, use_child_gene_prob=0.5)[source]
Simulated Binary Crossover operation used by
NSGAIISampler
.Generates a child from two parent individuals according to the polynomial probability distribution.
In the paper, SBX has only one argument,
eta
, and generate two child individuals. However, Optuna can only return one child individual in one crossover operation, so it uses theuniform_crossover_prob
anduse_child_gene_prob
arguments to make two individuals into one.- Parameters:
eta (float | None) – Distribution index. A small value of
eta
allows distant solutions to be selected as children solutions. If not specified, takes default value of2
for single objective functions and20
for multi objective.uniform_crossover_prob (float) –
uniform_crossover_prob
is the probability of uniform crossover between two individuals selected as candidate child individuals. This argument is whether or not two individuals are crossover to make one child individual. If theuniform_crossover_prob
exceeds 0.5, the result is equivalent to1-uniform_crossover_prob
, because it returns one of the two individuals of the crossover result. If not specified, takes default value of0.5
. The range of values is[0.0, 1.0]
.use_child_gene_prob (float) –
use_child_gene_prob
is the probability of using the value of the generated child variable rather than the value of the parent. This probability is applied to each variable individually. where1-use_chile_gene_prob
is the probability of using the parent’s values as it is. If not specified, takes default value of0.5
. The range of values is(0.0, 1.0]
.
Note
Added in v3.0.0 as an experimental feature. The interface may change in newer versions without prior notice. See https://github.com/optuna/optuna/releases/tag/v3.0.0.
Methods
crossover
(parents_params, rng, study, ...)Perform crossover of selected parent individuals.
Attributes
n_parents
- crossover(parents_params, rng, study, search_space_bounds)[source]
Perform crossover of selected parent individuals.
This method is called in
sample_relative()
.- Parameters:
parents_params (np.ndarray) – A
numpy.ndarray
with dimensionsnum_parents x num_parameters
. Represents a parameter space for each parent individual. This space is continuous for numerical parameters.rng (np.random.RandomState) – An instance of
numpy.random.RandomState
.study (Study) – Target study object.
search_space_bounds (np.ndarray) – A
numpy.ndarray
with dimensionslen_search_space x 2
representing numerical distribution bounds constructed from transformed search space.
- Returns:
A 1-dimensional
numpy.ndarray
containing new parameter combination.- Return type:
np.ndarray