pg.evolution.Choice¶
Accessible via pg.evolution.Choice
.
- class Choice(ops, limit=None, seed=None)[source]¶
Bases:
pg.evolution.Operation
Applying a list of operations with probabilities in a pipeline.
Example:
pg.evolution.Choice([ (pg.evolution.mutators.Uniform() ** 3, 0.5) (pg.evolution.mutators.Swap(), 0.4) ], limit=1)
The code above apply 3 pipelined uniform mutation with probability 0.5, and apply 1 swap between two multiple choices with probability 0.4. At most 1 operation can be applied.
Methods:
call
(inputs, global_state[, step])Subclasses should override this method.
- call(inputs, global_state, step=0)[source]¶
Subclasses should override this method.
The global_state and step are optional for the subclasses’ call signature.
- Return type:
- Parameters:
inputs – A list of values as inputs.
global_state – An AttributeDict object as the global state container, which is readable/writable during the operation.
step – Number of examples historically proposed, which can be used for determining a cross over schedule.
- Returns:
A list of values as output of current operation.