Lecture 7 Genetic Algorithms
Lecture 7 Genetic Algorithms
Motivation
learning methods is motivated by analogy to biological evolution
rather than search from general-to-specic or from simple-to-complex, genetic algorithms generate successor hypotheses by repeatedly mutating and recombining parts of the best currently known hypotheses at each step, a collection of hypotheses, called the current population, is updated by replacing some fraction by offspring of the most t current hypotheses
Motivation
reasons for popularity evolution is known to be a successful, robust method for adaption within biological systems genetic algorithms can search spaces of hypotheses containing complex interacting parts, where the impact of each part on overall hypothesis tness may be difcult to model genetic algorithms are easily parallelized genetic programming entire computer programs are evolved to certain tness criteria evolutionary computation = genetic algorithms + genetic programming
Genetic Algorithms
problem: search a space of candidate hypotheses to identify the best hypothesis the best hypothesis is dened as the one that optimizes a predened numerical measure, called tness e.g. if the task is to learn a strategy for playing chess, tness could be dened as the number of games won by the individual when playing against other individuals in the current population basic structure: iteratively updating a pool of hypotheses (population) on each iteration hypotheses are evaluated according to the tness function a new population is generated by selecting the most t individuals some are carried forward, others are used for creating new Lecture 7: Genetic Algorithms p. offspring individuals
Genetic Algorithms
GA(F itness, F itness_threshold, p, r, m) Fitness: tness function, Fitness_threshold: termination criterion, p: number of hypotheses in the population, r: fraction to be replaced by crossover, m: mutation rate Initialize population: P Generate p hypotheses at random Evaluate: For each h in P , compute F itnes(h) While [maxh F itness(h)] < F itness_threshold, Do 1. Select: Probabilistically select (1 r) p members of P to add to PS 2. Crossover: Probalistically select rp pairs of hypotheses from P . For each pair 2 < h1 , h2 > produce two offspring and add to PS 3. Mutate: Choose m percent of the members of PS with uniform probability. For each, invert one randomly selected bit 4. Update: P PS 5. Evaluate: for each h P , compute F itness(h) Return the hypothesis from P that has the highest tness.
Remarks
as specied above, each population P contains p hypotheses (1 r) p hypotheses are selected and added to PS without changing the selection is probabilistically the probability is given by P r(hi )
rp 2
p j=1
F itness(hi ) F itness(hj )
pairs of hypotheses are selected and added to PS after applying the crossover operator the selection is also probabilistically
(1 r) p + 2
rp 2
= p where r + (1 r) = 1
Representing Hypotheses
hypotheses are often representated as bit strings so that they can easily be modied by genetic operators representated hypotheses can be quite complex each attribute can be representated as a subtring with as many positions as there are possible values to obtain a xed-length bit string, each attribute has to be considered, even in the most general case (Outlook = Overcast Rain) (W ind = Strong) is representated as: Outlook 011, W ind 10 01110
Genetic Operators
generation of successors is determined by a set of operators that recombine and mutate selected members of the current population operators correspond to idealized versions of the genetic operations found in biological evolution the two most common operators are crossover and mutation
Genetic Operators
Initial strings Single-point crossover:
11101001000 00001010101 11111000000 11101010101 00001001000
Crossover Mask
Offspring
Two-point crossover:
11101001000 00001010101 00111110000 11001011000 00101000101
Uniform crossover:
11101001000 00001010101 10011010011 10001000100 01101011001
Point mutation:
11101001000
11101011000
Lecture 7: Genetic Algorithms p.
Genetic Operators
Cossover: produces two new offspring from two parent strings by copying selected bits from each parent bit at position i in each offspring is copied from the bit at position i in one of the two parents choice which parent contributes bit i is determined by an additional string, called cross-over mask single-point crossover: e.g. 11111000000 two-point crossover: e.g. 00111110000 uniform crossover: e.g. 01100110101 mutation: produces bitwise random changes
Genetic Programming
individuals in the evolving population are computer programs rather than bit strings has shown good results, despite vast H representing programs typical representations correspond to parse trees each function call is a node arguments are the descendants tness is determined by executing the programm on the training data crossover are performed by replacing a randomly chosen subtree between parents
Genetic Programming
+ + sin 2 x
+
^ + y
sin + ^ y
x
sin + ^ x 2 y
sin 2
^ ^ x 2
sin + + y
Summary
method for concept learning based on simulated evolution evolution of populations is simulated by taking the most t individuals over to a new generation some indiviuals remain unchanged, others are the base for genetic operator application hypotheses are commonly representated as bitstrings search through the hypothesis space cannot be characterized, because hypotheses are created by crossover and mutation operators that allow radical changes between successive generations hence, convergence is not guaranteed