pg.evolution.Pipeline#
Accessible via pg.evolution.Pipeline
.
- class Pipeline(ops)[source]#
Bases:
pg.evolution.Operation
Chaining operations into a pipeline.
A pipeline operation chains multiple operations by passing the output of previous operation to the next operations.
Example:
pg.evolution.Pipeline([ pg.evolution.selectors.Random(10) pg.evolution.selectors.Top(1), pg.evolution.mutators.Uniform() ])
which is equivalent to:
(pg.evolution.selectors.Random(10) >> pg.evolution.selectors.Top(1) >> pg.evolution.mutators.Uniform())
The code above returns a uniformly mutated DNA from the winner of 10 randomly selected DNA from 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.