Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS Fall 2016 (Shavlik©), Lecture 12, Week 6

Similar presentations


Presentation on theme: "CS Fall 2016 (Shavlik©), Lecture 12, Week 6"— Presentation transcript:

1 CS 540 - Fall 2016 (Shavlik©), Lecture 12, Week 6
2/23/2019 Today’s Topics Exam Review Thursday 10/20/16 (see note in Moodle) Genetic Algorithms Mutation Crossover Fitness-proportional Reproduction Premature Convergence Building-block Hypothesis 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

2 Genetic Algorithms (GAs)
Use ideas of Survival of fittest (death) Combination of ‘genetic material’ (sex) (‘Taxes’ play a role in some algo’s) Mutation (randomness) Mixing of genes from parents more important than mutation (contrary to popular press) About 25,000 human genes For simplicity, assume two variants of each So 225,000 possible combo’s to explore! 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

3 Basic FRAMEWORK for GAs (many possible ALGORITHMS)
Create initial population of entities Evaluate each entity using a fitness function Discard worst N% of entities K times, stochastically grab ‘best’ parents (fitness proportional reproduction) Combine them (crossover) to create new entities Make some random changes (mutation) Goto 2 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

4 Representing Entities as Bit Strings
Assume we represent our problem as a bit string (but any data structure ok for GAs) Cross Over (example on next slide) Pick two entities, A and B Choose a cross-over location Copy first part of A and last part of B Copy first part of B and last part of A Mutation Randomly flip 1 or more bits 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

5 CS 540 - Fall 2016 (Shavlik©), Lecture 12, Week 6
Crossover Example Entity A 1 Randomly chosen ‘cross over’ point Entity B 1 Child C 1 Child D 1 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

6 Aside: My Family Phones
My cell phone (#’s changed for anonymity) My wife’s cell phone Our daughter’s cell phone 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

7 CS 540 - Fall 2016 (Shavlik©), Lecture 12, Week 6
Typical Design Discard Worst HALF of Population Generate Children to Refill Population Keep Parents and Generated Children ‘Flip’ a Small Faction of Bits (eg, 0.1%) Flip bits in all member of population 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

8 Fitness-Proportional Reproduction
Let Fi be the fitness of entity i Assume Fi are non-negative (if not, use eFi as the fitness for the GA) Let Ftotal = ∑ Fi // Sum the fitness of all the entities Prob (entity i chosen) = Fi / Ftotal 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

9 CS 540 - Fall 2016 (Shavlik©), Lecture 12, Week 6
Roulette-Wheel View - spin arrow and see where it stops (pie-wedge size proportional to fitness) 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

10 A GA Approach to Supervised ML
Assume we want to learn a model of the form below (and all of our N features are numeric) if [ ∑ weighti ₓ featurei ] > threshold then return POS else return NEG Representation of Entities? See next slide Fitness? Accuracy on TRAIN set plus maybe some points for being different from rest of population Role of Tuning Set? Could chose best member of population when done If we use ALL of population (an ‘ensemble’), could weight each’s predictions based on tuneset accuracy 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

11 Possible Representation of Entities
. . . 16 bits for weight1 16 bits for weightN 16 bits for threshold Notes 1) we might only use 16 bits so weights are small (Occam’s Razor) 2) first bit could be SIGN (or use “2’s complement”) 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

12 CS 540 - Fall 2016 (Shavlik©), Lecture 12, Week 6
Design Tip Design your space of entities so that most are viable (ie, get a non-zero fitness) Otherwise will waste a lot of cpu cycles generating useless entities 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

13 Premature Convergence (‘Inbreeding’)
If not careful, entire population can become minor variations of a small number of ‘bit vectors’ Eg, consider crossing over A and child_of_A Result will be  ¾ a copy of A Solutions Don’t crossover with ‘recent’ descendent Mutate more (but might destroy good traits) 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

14 GAs as Searching a Space
Consider the space defined by single-bit mutations What is a CROSSOVER? Grab any two nodes (might not be adjacent) ‘hyper jump’ to a possibly distant 3rd node 101…01 001…01 101…00 001…00 101…10 011…10 001…00 etc 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

15 Building-Block Hypothesis
GAs work well when overall task has subtasks And fitness function gives credit for being able to solve subtasks Crossover ‘mixes and matches’ solutions to subtasks Eg, consider building cars Need to engine, wheels, windows, brakes, etc 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

16 Which Fitness Function Better for GAs?
State Space Fitness State Space 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

17 CS 540 - Fall 2016 (Shavlik©), Lecture 12, Week 6
Genetic Programming Entities need not be bit strings Often ‘genetic programming’ used for richer rep’s of entities Decision trees Neural networks Code snippets Etc 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

18 CS 540 - Fall 2016 (Shavlik©), Lecture 12, Week 6
In-Class HW Design Genetic Programming Approach for Creating Good Decision Trees Think for 1-2 Mins before Raising Hand 10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6

19 CS 540 - Fall 2016 (Shavlik©), Lecture 12, Week 6
GA Wrapup Can come up with quite creative solutions since many possibilities considered Might be too undirected? Designing good fitness functions can be a challenge Make more sense as computing power  10/13/16 CS Fall 2016 (Shavlik©), Lecture 12, Week 6


Download ppt "CS Fall 2016 (Shavlik©), Lecture 12, Week 6"

Similar presentations


Ads by Google