liveBook · Manning

Genome

As explained in Evolutionary Deep Learning: Genetic algorithms and neural networks

A genome is an encoded representation of an evolutionary candidate, including the genes that specify its neural-network structure and parameters.

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

How Evolutionary Deep Learning: Genetic algorithms and neural networks covers it

How deep it goes
Walks through genome creation, network construction, fitness scoring, configuration controls, and visualization, while deferring draw_net implementation specifics.
Examples
Uses XOR candidate and winning networks, visualized network diagrams, and circles classification with tuned mutation and speciation settings.
What it assumes
Assumes familiarity with fitness evaluation and mean squared error while demonstrating genome creation and evaluation through runnable Python code.
What you can do after
Apply it via NEAT-Python to configure, evolve, score, reconstruct, and visualize genome-encoded feed-forward networks.
How it connects
Connects genomes to NEAT, feed-forward networks, fitness, activation functions, speciation, mutation, and neural-network topology.

Also explained in

Compare how 2 books explain genome →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Evolutionary Deep Learning: Genetic algorithms and neural networks. The section links point to the parts of the book it draws on.