edo.operators package¶
Submodules¶
edo.operators.crossover module¶
Functions for the crossover process.

edo.operators.crossover.
crossover
(parent1, parent2, col_limits, families, random_state, prob=0.5)[source]¶ Blend the information from two parents to create a new
Individual
. Dimensions are inherited first, forming a “skeleton” that is filled with columnmetadata pairs. These pairs are selected from either parent uniformly. Missing values are filled in as necessary.Parameters:  parent1 : Individual
The first individual to be blended.
 parent2 : Individual
The second individual to be blended.
 col_limits : list
Lower and upper bounds on the number of columns
offspring
can have. Used in case of tuple limits. families : list
Families of distributions with which to create new columns. Used in case of tuple column limits.
 random_state : numpy.random.RandomState
The PRNG associated with the offspring.
 prob : float, optional
The cutoff probability with which to inherit dimensions from
parent1
overparent2
. Returns
 ——
 offspring : Individual
A new individual formed from the dimensions and columns of its parents.
edo.operators.mutation module¶
Functions related to the mutation operator.

edo.operators.mutation.
mutate_ncols
(dataframe, metadata, col_limits, families, weights, random_state, prob)[source]¶ Mutate the number of columns an individual has by adding a new column and/or dropping a column at random. In either case, the bounds defined in
col_limits
cannot be exceeded.

edo.operators.mutation.
mutate_nrows
(dataframe, metadata, row_limits, random_state, prob)[source]¶ Mutate the number of rows an individual has by adding a new row and/or dropping a row at random so as not to exceed the bounds of
row_limits
.

edo.operators.mutation.
mutate_values
(dataframe, metadata, random_state, prob)[source]¶ Iterate over the values of
dataframe
and mutate them each with probabilityprob
. Mutating a value is done by resampling from the associated column distribution inmetadata
.

edo.operators.mutation.
mutation
(individual, prob, row_limits, col_limits, families, weights=None)[source]¶ Mutate an individual. Here, the characteristics of an individual can be split into two parts: their dimensions, and their values. Each of these parts is mutated in a different way using the same probability,
prob
.Parameters:  individual : Individual
The individual to be mutated.
 prob : float
The probability with which any characteristic of
individual
should be mutated. row_limits : list
Lower and upper limits on the number of rows an individual can have.
 col_limits : list
Lower and upper limits on the number of columns an individual can have.
 families: list
Families of distributions with which to create new columns.
 weights : list, optional
Probabilities with which to sample a distribution
families
. IfNone
, sample uniformly.
Returns:  mutant : Individual
A (potentially) mutated individual.
edo.operators.selection module¶
The selection operator.

edo.operators.selection.
selection
(population, pop_fitness, best_prop, lucky_prop, random_state, maximise=False)[source]¶ Given a population, select a proportion of the “best” individuals and another of the “lucky” individuals (if they are available) to form a set of potential parents.
Parameters:  population : list
All current individuals.
 pop_fitness : list
The fitness of each individual in
population
. best_prop : float
The proportion of the fittest individuals in
population
to be selected. lucky_prop : float
The proportion of lucky individuals left in
population
to be selected after the “best” have been selected. maximise : bool, optional
Determines whether an individual’s fitness should be maximal or not. Defaults to
False
.
Returns:  parents : dict
The individuals chosen to potentially become parents and their index in the current population.
edo.operators.shrink module¶
Functions for shrinking the search space.

edo.operators.shrink.
shrink
(parents, families, itr, shrinkage)[source]¶ Given the current progress of the evolutionary algorithm, shrink its search space, i.e. the parameter spaces for each of the distribution classes in
families
.Parameters:  parents : list of Individual instances
The parent individuals for this iteration.
 families : list of Distribution instances
The families of distributions to be shrunk.
 itr : int
The current iteration.
 shrinkage : float
The shrinkage factor between 0 and 1.
Returns:  families : list of Distribution instances
The altered families.
edo.operators.util module¶
A collection of functions for use across several operators.
Module contents¶

edo.operators.
crossover
(parent1, parent2, col_limits, families, random_state, prob=0.5)[source]¶ Blend the information from two parents to create a new
Individual
. Dimensions are inherited first, forming a “skeleton” that is filled with columnmetadata pairs. These pairs are selected from either parent uniformly. Missing values are filled in as necessary.Parameters:  parent1 : Individual
The first individual to be blended.
 parent2 : Individual
The second individual to be blended.
 col_limits : list
Lower and upper bounds on the number of columns
offspring
can have. Used in case of tuple limits. families : list
Families of distributions with which to create new columns. Used in case of tuple column limits.
 random_state : numpy.random.RandomState
The PRNG associated with the offspring.
 prob : float, optional
The cutoff probability with which to inherit dimensions from
parent1
overparent2
. Returns
 ——
 offspring : Individual
A new individual formed from the dimensions and columns of its parents.

edo.operators.
mutation
(individual, prob, row_limits, col_limits, families, weights=None)[source]¶ Mutate an individual. Here, the characteristics of an individual can be split into two parts: their dimensions, and their values. Each of these parts is mutated in a different way using the same probability,
prob
.Parameters:  individual : Individual
The individual to be mutated.
 prob : float
The probability with which any characteristic of
individual
should be mutated. row_limits : list
Lower and upper limits on the number of rows an individual can have.
 col_limits : list
Lower and upper limits on the number of columns an individual can have.
 families: list
Families of distributions with which to create new columns.
 weights : list, optional
Probabilities with which to sample a distribution
families
. IfNone
, sample uniformly.
Returns:  mutant : Individual
A (potentially) mutated individual.

edo.operators.
selection
(population, pop_fitness, best_prop, lucky_prop, random_state, maximise=False)[source]¶ Given a population, select a proportion of the “best” individuals and another of the “lucky” individuals (if they are available) to form a set of potential parents.
Parameters:  population : list
All current individuals.
 pop_fitness : list
The fitness of each individual in
population
. best_prop : float
The proportion of the fittest individuals in
population
to be selected. lucky_prop : float
The proportion of lucky individuals left in
population
to be selected after the “best” have been selected. maximise : bool, optional
Determines whether an individual’s fitness should be maximal or not. Defaults to
False
.
Returns:  parents : dict
The individuals chosen to potentially become parents and their index in the current population.

edo.operators.
shrink
(parents, families, itr, shrinkage)[source]¶ Given the current progress of the evolutionary algorithm, shrink its search space, i.e. the parameter spaces for each of the distribution classes in
families
.Parameters:  parents : list of Individual instances
The parent individuals for this iteration.
 families : list of Distribution instances
The families of distributions to be shrunk.
 itr : int
The current iteration.
 shrinkage : float
The shrinkage factor between 0 and 1.
Returns:  families : list of Distribution instances
The altered families.