optuna.samplers.nsgaii.BaseCrossover

class optuna.samplers.nsgaii.BaseCrossover[source]

Base class for crossovers.

A crossover operation is used by NSGAIISampler to create new parameter combination from parameters of n parent individuals.

Note

Concrete implementations of this class are expected to only accept parameters from numerical distributions. At the moment, only crossover operation for categorical parameters (uniform crossover) is built-in into NSGAIISampler.

Methods

crossover(parents_params, rng, study, ...)

Perform crossover of selected parent individuals.

Attributes

n_parents

Number of parent individuals required to perform crossover.

abstract 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 (ndarray) – A numpy.ndarray with dimensions num_parents x num_parameters. Represents a parameter space for each parent individual. This space is continuous for numerical parameters.

  • rng (RandomState) – An instance of numpy.random.RandomState.

  • study (Study) – Target study object.

  • search_space_bounds (ndarray) – A numpy.ndarray with dimensions len_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:

ndarray

abstract property n_parents: int

Number of parent individuals required to perform crossover.