Member-only story

Machine learning basics (part 7): Evolutionary learning

Hang Nguyen
6 min readMay 16, 2022

--

The genetic algorithm models the genetic process that give rise to evolution. It models sexual reproduction, where both parents give some genetic information to their offspring.

The basic genetic algorithm

Initialization

Generate N random strings of length L within the chosen alphabet.

Learning

Repeat:

(1) Create a new population (initially empty)

(2) Repeat

(2.1) Select 2 strings from current population, preferably using fitness-proportional selection

(2.2) Recombine them in pairs to produce 2 new strings

(2.3) Mutate the offspring

(2.4) Either add 2 offspring to the population, or use tournaments to put 2 strings from the 4 of parents and offspring into the population.

(2.5) Until N strings for the new population are generated

(3) Optionally, use elitism to take the fittest strings from the parent generation and replace some others from the offspring generation.

(4) Keep track of the best string in the new population

(5) Replace old population with new one

Until stopping criteria (fixed number of generations run) is met.

The genetic algortihm (GA)

--

--

Hang Nguyen
Hang Nguyen

Written by Hang Nguyen

Just sharing (data) knowledge

No responses yet