Optimizer using FACE¶
FACEOptimizer¶
-
class
l2l.optimizers.face.optimizer.
FACEOptimizer
(traj, optimizee_create_individual, optimizee_fitness_weights, parameters, optimizee_bounding_func=None)[source]¶ Bases:
l2l.optimizers.optimizer.Optimizer
Class for Fully Adaptive Crossentropy Optimizer (adaptive sample size) In the pseudo code the algorithm does:
For n iterations do:
- Sample individuals from distribution
- evaluate individuals and get fitness
- check if gamma or best individuals fitness increased
- if not increase population size by n_expand (if not yet max_pop_size else stop) and sample again (1) else set pop_size = min_pop_size and proceed
- pick n_elite individuals with highest fitness
- Out of the remaining non-elite individuals, select them using a simulated-annealing style selection based on the difference between their fitness and the 1-rho quantile (gamma) fitness, and the current temperature
- Fit the distribution family to the new elite individuals by minimizing cross entropy. The distribution fitting is smoothed to prevent premature convergence to local minima. A weight equal to the smoothing parameter is assigned to the previous parameters when smoothing.
return final distribution parameters. (The final distribution parameters contain information regarding the location of the maxima)
Parameters: - traj (Trajectory) – Use this trajectory to store the parameters of the specific runs. The parameters should be initialized based on the values in parameters
- optimizee_create_individual – Function that creates a new individual. All parameters of the Individual-Dict returned should be of numpy.float64 type
- optimizee_fitness_weights – Fitness weights. The fitness returned by the Optimizee is multiplied by these values (one for each element of the fitness vector)
- parameters – Instance of
namedtuple()
FACEParameters
containing the parameters needed by the Optimizer
-
post_process
(traj, fitnesses_results)[source]¶ See
post_process()
FACEParameters¶
-
class
l2l.optimizers.face.optimizer.
FACEParameters
¶ Bases:
tuple
Parameters: - min_pop_size – Minimal number of individuals per simulation.
- max_pop_size – This is the minimum amount of samples taken into account for the FACE algorithm
- n_elite – Number of individuals to be considered as elite
- smoothing –
This is a factor between 0 and 1 that determines the weight assigned to the previous distribution parameters while calculating the new distribution parameters. The smoothing is done as a linear combination of the optimal parameters for the current data, and the previous distribution as follows:
new_params = smoothing*old_params + (1-smoothing)*optimal_new_params - temp_decay – This parameter is the factor (necessarily between 0 and 1) by which the temperature decays each
generation. To see the use of temperature, look at the documentation of
FACEOptimizer
- n_iteration – Number of iterations to perform
- distribution – Distribution class to use. Has to implement a fit and sample function.
- stop_criterion – (Optional) Stop if this fitness is reached.
- n_expand – (Optional) This is the amount by which the sample size is increased if FACE becomes active
-
distribution
¶
-
max_pop_size
¶
-
min_pop_size
¶
-
n_elite
¶
-
n_expand
¶
-
n_iteration
¶
-
seed
¶
-
smoothing
¶
-
stop_criterion
¶
-
temp_decay
¶