pyneat.innovation module

Module for tracking structural innovations in genomes during evolution.

class pyneat.innovation.InnovationRecord(key, innov_type, node_in, node_out)[source]

Bases: object

Record information about a structural mutations for comparison against other mutations.

key

A unique identifier for the record.

Type:int
innov_type

The type of structural mutation that occurred.

Type:InnovationType
node_in

The incoming node for the new connection or node (at the time of the mutation occurring in the case of new node mutations).

Type:int
node_out

The outgoing node for the new connection or node (at the time of the mutation occurring in the case of new node mutations).

Type:int
class pyneat.innovation.InnovationStore[source]

Bases: object

Store records of new node and connection mutations for lookup. Also responsible for generating unique innovation keys.

key_to_record

A dictionary containing innovation records for each new structural mutation, indexed by innovation keys.

Type:dict
mutation_to_key

A dictionary containing innovation keys, indexed by mutations (node_in, node_out, innovation_type).

Type:dict
_innovation_key_generator

Generates the next innovation key.

Type:generator
get_innovation_key(node_in, node_out, innovation_type)[source]

Get a new or existing innovation key for a structural mutation.

Parameters:
  • node_in (int) – The input node to the new node/connection.
  • node_out (int) – The output node to the new node/connection.
  • innovation_type (InnovationType) – The type of structural mutation.
Returns:

The innovation key for the mutation.

Return type:

int

class pyneat.innovation.InnovationType[source]

Bases: enum.Enum

Define the types of structural innovations.

NEW_BIAS = 2
NEW_CONNECTION = 1
NEW_NODE = 0