Presentation is loading. Please wait.

Presentation is loading. Please wait.

Genetic Algorithms. Evolutionary Methods Methods inspired by the process of biological evolution. Main ideas: Population of solutions Assign a score or.

Similar presentations


Presentation on theme: "Genetic Algorithms. Evolutionary Methods Methods inspired by the process of biological evolution. Main ideas: Population of solutions Assign a score or."— Presentation transcript:

1 Genetic Algorithms

2 Evolutionary Methods Methods inspired by the process of biological evolution. Main ideas: Population of solutions Assign a score or fitness value to each solution Retain the best solutions (survival of the fittest) Generate new solutions (offspring)

3 Figure 7.2

4 Genetic Algorithms The fundamental unit of representation is a chromosome. A chromosome is a bit of strings representing a solution to our problem. 00010011110011111 In our case, a chromosome will be a classifier or hypothesis. A hypothesis is good if it has a high fitness value. What is a fitness value? In classification, for example, the fitness value could be the accuracy of the hypothesis on test examples.

5 Parameters A genetic algorithm has the following parameters:  A fitness function that gives a score to every hypothesis.  Θ: A fitness threshold above which we stop and take the hypothesis with best fit.  L: The number of hypothesis in the current population.  Pco: the fraction of hypothesis replaced by cross-over.  Pmut: the mutation rate.

6 Algorithm Initialize population with L hypotheses at random Repeat For each hypothesis h compute its fitness Rank all hypotheses based on their fitness value Generate a new population using genetic operators Until max_fitness > Θ Return the hypothesis with highest fitness

7 Figure 7.13

8 Genetic Operators The most common operators are crossover, mutation, and replication. Crossover (exploration): There are different variations. The most common is called single-point crossover: Initial Strings Crossover Mask Offspring 11101001000 11101010101 11111000000 00001010101 00001001000

9 Genetic Operators Mutation: The idea is to produce small changes to a string at random. Under a uniform distribution, we select one bit and switch its value. 00001010101 01001010101 Select second bit. Replication: A chromosome is simply reproduced, and left unchanged.

10 Figure 7.14

11 New Population Create a new generation Ps: 1.Replicate (1-Pco)L members of P and add them to Ps (Exploitation). The probability of selecting a member is P(hi) = Fitness (hi) / Σj Fitness (hj) 2.Crossover.- select (Pco L)/2 pairs of hypotheses from P according to P(hi) (Exploration). For each pair (h1,h2) produce two offspring by applying the Crossover operator. Add all offspring to Ps. 3.Mutate.- Choose (Pmut L) members of Ps with uniform probability. Invert one bit in the representation randomly (Exploration). 4.Update P with Ps

12 Representing Hypotheses We need to represent each hypothesis as a binary string. We can encode as bits of strings: Neural Networks Decision Trees etc.

13 Figure 7.15

14 Fitness Function and Selection Selection. The typical approach is the “fitness proportionate selection” or “roulette wheel selection”: P(hi) = Fitness (hi) / Σj Fitness (hj) Other options are rank selection: Rank according to fitness, but then select based on rank only.

15 Further Heuristics Other heuristics exist to improve performance: 1.Adjust the mutation and crossover rates to ensure that convergence is fast. One way to do it is by encoding their values and letting the genetic algorithm adapt them. 2.Use ternary or n-ary chromosomes (instead of binary). The advantage is that classifiers become easier to encode.

16 Exploration vs Exploitation Exploitation: Maximize reward by exploiting optimal and known solutions. vs Exploration: Maximize long-term reward by searching for new solutions.

17 John H. Holland Born in Indiana 1929. Author of “Adaptation in Natural and Artificial Systems” written in 1975, providing the basis of genetic algorithms. Recipient of the McArthur Fellowship.

18 Genetic Programming Genetic programming is a form of evolutionary computation in which the individuals in the population are computer programs. Programs are normally represented by trees. A program is executed by parsing the tree. Example: + sin sqrt x + ^ y x 2 F = sin(x) + sqrt( x^2 + y)

19 Vocabulary To apply genetic programming one has to define the functions that can be applied: Example: sin, cos, sqrt, +, -, etc. A genetic programming algorithm explores the space of combinations of these functions. The fitness of an individual is determined by executing the program on a set of training data.

20 Cross Over The crossover operator is performed by replacing subtrees of one program with subtrees of another program. + Sin ^ x + x y + Sin sqrt x + ^ y x 2 2

21 Cross Over: Result + Sin ^ x ^ x y + Sin sqrt x + + y x 2 2

22 Figure 7.17

23 J.R. Koza Author of “Genetic Programming I II III and IV”. Professor Stanford University Member of several editorial boards.


Download ppt "Genetic Algorithms. Evolutionary Methods Methods inspired by the process of biological evolution. Main ideas: Population of solutions Assign a score or."

Similar presentations


Ads by Google