A genome encodes one evolutionary candidate in NEAT. NEAT-Python uses it to construct a feed-forward neural network, evaluate that network on data, and store its resulting fitness. A population therefore contains genomes rather than a single network being trained directly. section 10.1
A genome is created from the configured genome type, given a unique key, and initialized with the genome configuration. Its evolution is controlled through configuration: node and connection additions or deletions, activation and aggregation functions, and weights can all be adjusted. section 10.2 section 10.5.1
XOR candidate network
For XOR, each genome begins with fitness 4.0. Its constructed network is activated on four input pairs, and each squared output error reduces that score. The winning genome is converted into a network and checked against the expected XOR outputs. section 10.1
Listing 10.10 EDL_10_2_NEAT_XOR_Visualized.ipynb: Visualizing the winning genome
winner = p.run(eval_genomes) #1
print('\nBest genome:\n{!s}'.format(winner)) #2
print('\nOutput:')
winner_net = neat.nn.FeedForwardNetwork.create(winner, config)
for xi, xo in zip(X, Y): #3
output = winner_net.activate(xi)
print(" input {!r}, expected output {!r}, got {!r}".format(xi, xo,
output))
draw_net(config, winner, True, node_names=node_names) #4
The winning genome can be turned back into a feed-forward network, tested on inputs, and drawn to inspect the evolved architecture. section 10.2
Visualizing a genome-derived network helps inspect how its architecture forms and can reveal overfitting or underfitting. A random starting network may include nodes without input or output connections; unused nodes can be eliminated as evolution proceeds. section 10.2 section 10.3

