liveBook · Manning

Elite selection

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

Best selection chooses the highest-performing individuals as parents for reproduction.

Elite selection chooses the highest-performing individuals as parents for reproduction. A simple genetic algorithm can select the two fittest individuals to parent the entire next generation. section 2.5.5

The mechanism is deliberately direct: sort the population’s fitness values, take the top two indexes, and use those indexes to retrieve parents before crossover produces offspring. section 2.5.5

Selecting the two fittest parents

The implementation returns the highest fitness indexes in descending order: elite_selection(fitness) returns fitness.argsort()[-2:][::-1]. Those indexes can retrieve parents with pop[parents[idx]]. section 2.5.5

Listing 2.16 EDL_2_5_Genetic_Algorithms.ipynb: Selecting the fittest
def elite_selection(fitness):
  return fitness.argsort()[-2:][::-1]    #1
 
parents = elite_selection(fitness)
print(pop[parents[0]])

Inspect the compact listing that sorts fitness values, returns two parent indexes, and prints a selected individual. section 2.5.5

Use elite selection when:

  • Fast improvement matters and the population is not yet vulnerable to premature specialization. section 3.4
  • Replace it with more diverse selection when the population gets stuck at a local maximum or minimum. section 2.5.5 section 3.4

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

How deep it goes
Implements two-parent fitness sorting but stops short of explaining more diverse selection strategies in detail.
Examples
Uses an elite_selection function, fitness.argsort(), parent indexes, and population indexing.
What it assumes
Assumes a population has already been evaluated for fitness and can be indexed by returned parent positions.
What you can do after
Build it from scratch by sorting fitness values and retrieving the top two parent individuals.
How it connects
Connects fitness evaluation, population indexing, crossover, genetic algorithms, and population diversity.

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.