pg.evolution.SymmetricDifference¶
Accessible via pg.evolution.SymmetricDifference
.
- class SymmetricDifference(ops)[source]¶
Bases:
pg.evolution.Operation
Compute the symmetric difference of operation outputs based on the input.
A symmetric difference operation passes the input to all its child selectors, and include the items that only appear in a single operation output. The items in the output will follow the order of their presences in the input.
Example:
pg.evolution.SymmetricDifference([ pg.evolution.selectors.Top(10), pg.evolution.selectors.First(10) ])
which is equivalent to:
pg.evolution.selectors.Top(10) ^ pg.evolution.selectors.First(10)
The code above returns items that are either among the top 10 or among the first 10 but not both.
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.