Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK...

18
Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012

Transcript of Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK...

Page 1: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Introduction to Evolutionary AlgorithmsSession 4

Jim Smith

University of the West of England, UK

May/June 2012

Page 2: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Example of learning models from data– Continuous Representations– Tree-based Representations

Practical session with Genetic Programming

2

Overview

Page 3: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Real valued problems

Many problems occur as real valued problems, e.g. continuous parameter optimisation f : n

Illustration: Ackley’s function (often used in EC)

3

Page 4: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Floating point mutations

4

• Each gene is changed independently: x -> x’ by adding

a random number

• Simple Uniform mutation: x’ = Rand[LB,UB] .

• Analogous to bit-flipping or resetting ,

• loses all sense of locality, no exploitation

• Most common method to use a Gaussian

distribution and then restrict to range [LB,UB].

Page 5: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Crossover operators for real valued GAs

Discrete:– each gene in offspring comes from one of its

parents with equal probability. Intermediate

– exploits idea of creating children “between” parents (hence a.k.a. arithmetic recombination)

– ith gene of offspring = parent1i + (1 - ) parent2i where : 0 1.

– The parameter can be:• constant: uniform arithmetical crossover• variable (e.g. depend on the age of the population) • picked at random every time

5

Page 6: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

6

Demo2: Es for moving targets

Page 7: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Tree based representation

Trees are a universal form, e.g. consider Arithmetic formula

Logical formula

Program

15)3(2

yx

(x true) (( x y ) (z (x y)))

i =1;while (i < 20){

i = i +1}

Page 8: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Tree based representation

15)3(2

yx

Page 9: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Tree based representation

(x true) (( x y ) (z (x y)))

Page 10: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Tree based representation

i =1;while (i < 20){

i = i +1}

Page 11: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Tree based representation

In GA, ES, EP chromosomes are linear structures (bit strings, integer string, real-valued vectors, permutations)

Tree shaped chromosomes are non-linear structures

In GA, ES, EP the size of the chromosomes is fixed

Trees in GP may vary in depth and width

Page 12: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Mutation

Most common mutation: replace randomly chosen subtree by randomly generated tree

Page 13: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Mutation cont’d

Mutation has two parameters:– Probability pm to choose mutation vs. recombination– Probability to chose an internal point as the root of

the subtree to be replaced

Remarkably pm is advised to be 0 (Koza’92) or very small, like 0.05 (Banzhaf et al. ’98)

The size of the child can exceed the size of the parent

Page 14: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Recombination

Most common recombination: exchange two randomly chosen subtrees among the parents

Recombination has two parameters:– Probability pc to choose recombination vs. mutation– Probability to chose an internal point within each

parent as crossover point The size of offspring can exceed that of the

parents

Page 15: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Child 2

Parent 1 Parent 2

Child 1

Page 16: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

Initialisation

Maximum initial depth of trees Dmax is set

Full method (each branch has depth = Dmax):– nodes at depth d < Dmax randomly chosen from function set F

– nodes at depth d = Dmax randomly chosen from terminal set T

Grow method (each branch has depth Dmax):– nodes at depth d < Dmax randomly chosen from F T– nodes at depth d = Dmax randomly chosen from T

Common GP initialisation: ramped half-and-half, where grow & full method each deliver half of initial population

Page 17: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

EAsare widely used to search sets of possible:– Designs e.g. optimisation– Sequences e.g path finding, scheduling ,…– Models – e.g. data mining / machine learning

Much of their strength comes from lack of assumptions.

Lots of free implementations mean you can focus on:– representing your problem– Giving fitness to a solution

17

Summary

Page 18: Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.

www.bit.uwe.ac.uk/~jsmith/UNESPcourse/EC4.html Using EAs to build a model from data:

– Given a set of labelled data (experiences, stimulus-response, cause-effect,...) task is to find a model that maps inputs onto the right outputs

– learning to recognise things, characterising opponents, diagnostic support, ...

So we can then use it to for future data– Predicting weather, stock market, …– Classifying images, fraud, …

18

Practical Activity: