pg.evolution.Power¶
Accessible via pg.evolution.Power
.
- class Power(op, k)[source]¶
Bases:
pg.evolution.Operation
Pipeline a repeated operation multiple times.
Power(x, k) (or x ** k) is equivalent to x >> x >> … >> x (k items).
Example:
pg.evolution.Power(pg.evolution.mutators.Uniform, 3)
which is equivalent to:
pg.evolution.mutators.Uniform() ** 3
The code above creates a DNA with 3 mutated positions for each DNA in the input,
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.