DE#
DEBase(cs=None, f=None, dimensions=None, pop_size=None, max_age=None, mutation_factor=None, crossover_prob=None, strategy=None, boundary_fix_type='random', config_repository=None, seed=None, **kwargs)
#
Base class for Differential Evolution
Source code in src/dehb/optimizers/de.py
sample_population(size=3, alt_pop=None)
#
Samples 'size' individuals
If alt_pop is None or a list/array of None, sample from own population Else sample from the specified alternate population (alt_pop)
Source code in src/dehb/optimizers/de.py
boundary_check(vector)
#
Checks whether each of the dimensions of the input vector are within [0, 1]. If not, values of those dimensions are replaced with the type of fix selected.
if fix_type == 'random', the values are replaced with a random sampling from (0,1) if fix_type == 'clip', the values are clipped to the closest limit from {0, 1}
Parameters#
vector : array
Returns#
array
Source code in src/dehb/optimizers/de.py
vector_to_configspace(vector)
#
Converts numpy array to ConfigSpace object
Works when self.cs is a ConfigSpace object and the input vector is in the domain [0, 1].
Source code in src/dehb/optimizers/de.py
configspace_to_vector(config)
#
Converts ConfigSpace object to numpy array scaled to [0,1]
Works when self.cs is a ConfigSpace object and the input config is a ConfigSpace object. Handles conditional spaces implicitly by replacing illegal parameters with default values to maintain the dimensionality of the vector.
Source code in src/dehb/optimizers/de.py
DE(cs=None, f=None, dimensions=None, pop_size=20, max_age=np.inf, mutation_factor=None, crossover_prob=None, strategy='rand1_bin', encoding=False, dim_map=None, seed=None, config_repository=None, **kwargs)
#
Bases: DEBase
Source code in src/dehb/optimizers/de.py
__getstate__()
#
Allows the object to picklable while having Dask client as a class attribute.
Source code in src/dehb/optimizers/de.py
__del__()
#
init_eval_pop(fidelity=None, eval=True, **kwargs)
#
Creates new population of 'pop_size' and evaluates individuals.
Source code in src/dehb/optimizers/de.py
eval_pop(population=None, population_ids=None, fidelity=None, **kwargs)
#
Evaluates a population
If population=None, the current population's fitness will be evaluated If population!=None, this population will be evaluated
Source code in src/dehb/optimizers/de.py
mutation_rand1(r1, r2, r3)
#
mutation_rand2(r1, r2, r3, r4, r5)
#
Performs the 'rand2' type of DE mutation
mutation(current=None, best=None, alt_pop=None)
#
Performs DE mutation
Source code in src/dehb/optimizers/de.py
crossover_bin(target, mutant)
#
Performs the binomial crossover of DE
Source code in src/dehb/optimizers/de.py
crossover_exp(target, mutant)
#
Performs the exponential crossover of DE
Source code in src/dehb/optimizers/de.py
crossover(target, mutant)
#
Performs DE crossover
Source code in src/dehb/optimizers/de.py
selection(trials, trial_ids, fidelity=None, **kwargs)
#
Carries out a parent-offspring competition given a set of trial population
Source code in src/dehb/optimizers/de.py
evolve_generation(fidelity=None, best=None, alt_pop=None, **kwargs)
#
Performs a complete DE evolution: mutation -> crossover -> selection
Source code in src/dehb/optimizers/de.py
sample_mutants(size, population=None)
#
Generates 'size' mutants from the population using rand1
Source code in src/dehb/optimizers/de.py
AsyncDE(cs=None, f=None, dimensions=None, pop_size=None, max_age=np.inf, mutation_factor=None, crossover_prob=None, strategy='rand1_bin', async_strategy='immediate', seed=None, rng=None, config_repository=None, **kwargs)
#
Bases: DE
Extends DE to be Asynchronous with variations
Parameters#
async_strategy : str 'deferred' - target will be chosen sequentially from the population the winner of the selection step will be included in the population only after the entire population has had a selection step in that generation 'immediate' - target will be chosen sequentially from the population the winner of the selection step is included in the population right away 'random' - target will be chosen randomly from the population for mutation-crossover the winner of the selection step is included in the population right away 'worst' - the worst individual will be chosen as the target the winner of the selection step is included in the population right away {immediate, worst, random} implement Asynchronous-DE
Source code in src/dehb/optimizers/de.py
mutation(current=None, best=None, alt_pop=None)
#
Performs DE mutation
Source code in src/dehb/optimizers/de.py
sample_mutants(size, population=None)
#
Samples 'size' mutants from the population
Source code in src/dehb/optimizers/de.py
evolve_generation(fidelity=None, best=None, alt_pop=None, **kwargs)
#
Performs a complete DE evolution, mutation -> crossover -> selection