NEAT-Python allows the user to provide drop-in replacements for some parts of the NEAT algorithm, which hopefully makes it easier to implement common variations of the algorithm as mentioned in the literature. If you find that you’d like to be able to customize something not shown here, please submit an issue on GitHub.
New activation functions¶
def sinc(x): return 1.0 if x == 0 else sin(x) / x config.genome_config.add_activation('my_sinc_function', sinc)
The first argument to
add_activation is the name by which this activation function will be referred to in the configuration settings file.
This is demonstrated in the memory-fixed example.
The Population class makes calls to a collection of zero or more reporters at fixed points during the evolution
process. The user can add a custom reporter to this collection by calling Population.add_reporter and providing
it with an object which implements the same interface as
reporting.py), probably partially by subclassing it.
New genome types¶
To use a different genome type, you can create a custom class whose interface matches that of
DefaultGenome and pass this as the
genome_type argument to the
Config constructor. The minimum genome type interface is documented here: Genome Interface.
This is demonstrated in the circuit evolution example.
Alternatively, you can subclass
DefaultGenome in cases where you need to just add some extra behavior.
This is done in the OpenAI lander example to
add an evolvable per-genome reward discount value. It is also done in the
iznn setup, with
TODO: Further document species set interface (some done in module_summaries)
TODO: Include example
Species stagnation scheme¶
The default species stagnation scheme is a simple fixed stagnation limit–when a species exhibits
no improvement for a fixed number of generations, all its members are removed from the simulation. This
behavior is encapsulated in the
To use a different species stagnation scheme, you must create a custom class whose interface matches that
DefaultStagnation, and provide it as the
stagnation_type argument to the
This is demonstrated in the interactive 2D image example.
The default reproduction scheme uses explicit fitness sharing. This behavior is encapsulated in the
DefaultReproduction class. The minimum reproduction type interface is documented here: Reproduction Interface
TODO: Include example