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
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
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].
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 = parent1 i + (1 - ) parent2 i 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
6 Demo2: Es for moving targets
Tree based representation Trees are a universal form, e.g. consider Arithmetic formula Logical formula Program (x true) (( x y ) (z (x y))) i =1; while (i < 20) { i = i +1 }
Tree based representation
(x true) (( x y ) (z (x y)))
Tree based representation i =1; while (i < 20) { i = i +1 }
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
Mutation Most common mutation: replace randomly chosen subtree by randomly generated tree
Mutation cont’d Mutation has two parameters: – Probability p m to choose mutation vs. recombination – Probability to chose an internal point as the root of the subtree to be replaced Remarkably p m 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
Recombination Most common recombination: exchange two randomly chosen subtrees among the parents Recombination has two parameters: – Probability p c 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
Child 2 Parent 1Parent 2 Child 1
Initialisation Maximum initial depth of trees D max is set Full method (each branch has depth = D max ): – nodes at depth d < D max randomly chosen from function set F – nodes at depth d = D max randomly chosen from terminal set T Grow method (each branch has depth D max ): – nodes at depth d < D max randomly chosen from F T – nodes at depth d = D max randomly chosen from T Common GP initialisation: ramped half-and-half, where grow & full method each deliver half of initial population
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
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: