Genetic Algorithms. Evolutionary Methods Methods inspired by the process of biological evolution....

Post on 17-Jan-2016

214 views 0 download

Transcript of Genetic Algorithms. Evolutionary Methods Methods inspired by the process of biological evolution....

Genetic Genetic AlgorithmsAlgorithms

Evolutionary Methods Evolutionary Methods

Methods inspired by the process of biological evolution.

Main ideas:

Population of solutions

Assign a score orfitness value to each solution

Retain the bestsolutions (survival of the fittest)

Generate newsolutions (offspring)

Figure 7.2Figure 7.2

Genetic AlgorithmsGenetic 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 bethe accuracy of the hypothesis on test examples.

ParametersParameters

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.

AlgorithmAlgorithm

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

Figure 7.13Figure 7.13

Genetic OperatorsGenetic OperatorsThe most common operators are crossover, mutation, and replication.

Crossover (exploration):

There are different variations. The most common is called single-pointcrossover:

Initial Strings Crossover Mask Offspring

11101001000 11101010101 11111000000

00001010101 00001001000

Genetic OperatorsGenetic 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.

Figure 7.14Figure 7.14

New PopulationNew 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

Representing HypothesesRepresenting Hypotheses

We need to represent each hypothesis as a binary string.

We can encode as bits of strings:

Neural Networks

Decision Trees

etc.

Figure 7.15Figure 7.15

Fitness Function and SelectionFitness 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.

Further HeuristicsFurther 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.

Exploration vs ExploitationExploration vs Exploitation

Exploitation: Maximize reward by exploitingoptimal and known solutions.

vs

Exploration: Maximize long-term rewardby searching for new solutions.

John H. HollandJohn 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.

Genetic ProgrammingGenetic 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 executedby parsing the tree. Example:

+

sin sqrt

x + ^ y x 2

F = sin(x) + sqrt( x^2 + y)

VocabularyVocabulary

To apply genetic programming one has to define the functionsthat 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.

Cross OverCross Over

The crossover operator is performed by replacing subtrees ofone program with subtrees of another program.

+

Sin ^

x + x y

+

Sin sqrt

x + ^ y x 2

2

Cross Over: ResultCross Over: Result

+

Sin ^

x ^ x y

+

Sin sqrt

x + + y x 2

2

Figure 7.17Figure 7.17

J.R. KozaJ.R. Koza

Author of “Genetic Programming I II III and IV”. Professor Stanford UniversityMember of several editorial boards.