Genetic Programming. What is Genetic Programming? GP for Symbolic Regression Other Representations for GP Example of GP for Knowledge Discovery Outline.

Slides:



Advertisements
Similar presentations
1 Parsing The scanner recognizes words The parser recognizes syntactic units Parser operations: Check and verify syntax based on specified syntax rules.
Advertisements

Grammars, constituency and order A grammar describes the legal strings of a language in terms of constituency and order. For example, a grammar for a fragment.
Grammars, Languages and Parse Trees. Language Let V be an alphabet or vocabulary V* is set of all strings over V A language L is a subset of V*, i.e.,
ICE1341 Programming Languages Spring 2005 Lecture #5 Lecture #5 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
Biologically Inspired AI (mostly GAs). Some Examples of Biologically Inspired Computation Neural networks Evolutionary computation (e.g., genetic algorithms)
Non-Linear Problems General approach. Non-linear Optimization Many objective functions, tend to be non-linear. Design problems for which the objective.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
A new crossover technique in Genetic Programming Janet Clegg Intelligent Systems Group Electronics Department.
Context-Free Grammars Lecture 7
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Doug Downey, adapted from Bryan Pardo, Machine Learning EECS 349 Machine Learning Genetic Programming.
Discussion #31/20 Discussion #3 Grammar Formalization & Parse-Tree Construction.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Chapter 3: Formal Translation Models
16 November, 2005 Statistics in HEP, Manchester 1.
Genetic Programming.
Genetic Programming Chapter 6. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Programming GP quick overview Developed: USA.
Chapter 2 Syntax A language that is simple to parse for the compiler is also simple to parse for the human programmer. N. Wirth.
1 Syntax and Semantics The Purpose of Syntax Problem of Describing Syntax Formal Methods of Describing Syntax Derivations and Parse Trees Sebesta Chapter.
2.2 A Simple Syntax-Directed Translator Syntax-Directed Translation 2.4 Parsing 2.5 A Translator for Simple Expressions 2.6 Lexical Analysis.
1 Introduction to Parsing Lecture 5. 2 Outline Regular languages revisited Parser overview Context-free grammars (CFG’s) Derivations.
Genetic Algorithm.
Neural and Evolutionary Computing - Lecture 7 1 Evolutionary Programming The origins: L. Fogel (1960) – development of methods which generate automatically.
CPSC 388 – Compiler Design and Construction Parsers – Context Free Grammars.
Different Varieties of Genetic Programming Je-Gun Joung.
Zorica Stanimirović Faculty of Mathematics, University of Belgrade
A sentence (S) is composed of a noun phrase (NP) and a verb phrase (VP). A noun phrase may be composed of a determiner (D/DET) and a noun (N). A noun phrase.
What is Genetic Programming? Genetic programming is a model of programming which uses the ideas (and some of the terminology) of biological evolution to.
Context Free Grammars CIS 361. Introduction Finite Automata accept all regular languages and only regular languages Many simple languages are non regular:
CS Describing Syntax CS 3360 Spring 2012 Sec Adapted from Addison Wesley’s lecture notes (Copyright © 2004 Pearson Addison Wesley)
PART I: overview material
Introduction to Evolutionary Algorithms Session 4 Jim Smith University of the West of England, UK May/June 2012.
TextBook Concepts of Programming Languages, Robert W. Sebesta, (10th edition), Addison-Wesley Publishing Company CSCI18 - Concepts of Programming languages.
G ENETIC P ROGRAMMING Ranga Rodrigo March 17,
CMSC 330: Organization of Programming Languages Context-Free Grammars.
1 Appendix D: Application of Genetic Algorithm in Classification Duong Tuan Anh 5/2014.
Chapter 3 Describing Syntax and Semantics
Chapter 9 Genetic Algorithms.  Based upon biological evolution  Generate successor hypothesis based upon repeated mutations  Acts as a randomized parallel.
Genetic Programming. GP quick overview Developed: USA in the 1990’s Early names: J. Koza Typically applied to: machine learning tasks (prediction, classification…)
Context Free Grammars CFGs –Add recursion to regular expressions Nested constructions –Notation expression  identifier | number | - expression | ( expression.
2101INT – Principles of Intelligent Systems Lecture 11.
EE749 I ntroduction to Artificial I ntelligence Genetic Algorithms The Simple GA.
Genetic Programming A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Chapter 6.
Automated discovery in math Machine learning techniques (GP, ILP, etc.) have been successfully applied in science Machine learning techniques (GP, ILP,
Grammars Hopcroft, Motawi, Ullman, Chap 5. Grammars Describes underlying rules (syntax) of programming languages Compilers (parsers) are based on such.
Grammars CS 130: Theory of Computation HMU textbook, Chap 5.
Chapter 3 Context-Free Grammars Dr. Frank Lee. 3.1 CFG Definition The next phase of compilation after lexical analysis is syntax analysis. This phase.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 2 Syntax A language that is simple to parse.
Introduction Genetic programming falls into the category of evolutionary algorithms. Genetic algorithms vs. genetic programming. Concept developed by John.
Genetic Algorithm Dr. Md. Al-amin Bhuiyan Professor, Dept. of CSE Jahangirnagar University.
Genetic Programming Using Simulated Natural Selection to Automatically Write Programs.
CSE 311 Foundations of Computing I Lecture 19 Recursive Definitions: Context-Free Grammars and Languages Autumn 2012 CSE
Syntax Analysis By Noor Dhia Syntax analysis:- Syntax analysis or parsing is the most important phase of a compiler. The syntax analyzer considers.
Genetic Algorithm. Outline Motivation Genetic algorithms An illustrative example Hypothesis space search.
Genetic Programming.
Chapter 3 – Describing Syntax
Introduction Genetic programming falls into the category of evolutionary algorithms. Genetic algorithms vs. genetic programming. Concept developed by John.
Evolution strategies and genetic programming
Artificial Intelligence Chapter 4. Machine Evolution
Thinking about grammars
Lecture 7: Introduction to Parsing (Syntax Analysis)
R.Rajkumar Asst.Professor CSE
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Artificial Intelligence Chapter 4. Machine Evolution
Genetic Programming Chapter 6.
Genetic Programming.
Genetic Programming Chapter 6.
Genetic Programming Chapter 6.
Thinking about grammars
Beyond Classical Search
Presentation transcript:

Genetic Programming

What is Genetic Programming? GP for Symbolic Regression Other Representations for GP Example of GP for Knowledge Discovery Outline Genetic Programming2

Given a set of input-output data, Genetic programming (GP) searches for a relationship (i.e., expression, function, or program) between the input and the output GP Algorithm: (Koza, 1992) 1.Define a primitive set of possible functions (operators) and terminals (variables and constants) for the program. 2.Generate an initial population of random programs. 3.Repeat until termination: ○Calculate the fitness of each program by running it on a set of fitness cases (input-output data). ○Apply selection, crossover, andmutation. What is Genetic Programming? Genetic Programming3

Example: Curve fitting –Given the following observations of input and output of a system, find a curve that best fits the data The ideal function to be identified: f(x) = x sin x GP for Symbolic Regression Genetic Programming4

An algebraic expression (program) is represented by its parse tree –Internal nodes can be functions (operators) –Leaf nodes can be variables and constants, aka terminals Example: The expression x sin x in a prefix notation: (+ (^ x 0.5) sin x) Parse Tree Representation Genetic Programming5 Chromosome representation Parse tree representation

Syntactically correct trees should be generated randomly –For each node an element is selected from the primitive set –The root of a tree must be a function –A node containing a function should have k child nodes, where k is the number of arguments of that function –A node containing a variable or a constant has no child Special care must be taken to restrict the maximum tree size in the initial population –Usually the maximum depth of a tree is controlled not to exceed a certain predetermined limit Initialization Genetic Programming6

The fitness of an individual program e can be obtained by calculating the sum of absolute errors on the fitness cases: y(k)  value of the k th fitness case e(k)  value of individual program e on the k th fitness case Evaluation Genetic Programming7

Subtree crossover: –Randomly pick a node in each parent tree and exchange the subtrees rooted at those selected nodes to generate two offspring Reproductive Operators Genetic Programming8 One offspring

Point mutation: –Randomly pick a node in a tree and replace it by other compatible element in the primitive set Reproductive Operators Genetic Programming9

The representation based on the prefix notation has some shortcomings: –Chromosomes have variable length, which creates some inconveniences in designing reproductive operators ○Simple crossover and mutation, e.g., single-point crossover and bit-flip mutation, might generate illegal offspring ○Chromosomes need to be transformed into parse trees for crossover or mutation Other Representations for GP Genetic Programming10

Gene Expression Programming Genetic Programming11 head tail Gene expression programming (GEP) divides the fixed length chromosome into head and tail: –The head part has h genes of functions and terminals –The tail part has at most t = h(k – 1) + 1 terminals, where k is the maximum number of arguments required by the functions Example: h = 10, k = 2, t = 10(2 – 1) + 1 = 11

Decoding to a parse tree: –Nodes are expanded in a breadth-first manner starting from a root node –Each node, just before its expansion, is assigned a gene from the chromosome in a left-to-right order ○The number of nodes generated = the number of arguments ○Terminal nodes are not expanded GEP always produces a legal string as long as the tail part contains only the terminals –Ordinary crossover and mutation can be used Gene Expression Programming Genetic Programming12

Motivation: –To evolve complete programs in an arbitrary language using an integer array representation (O’Neill et al., 2001) ○Each integer indicates the production rule (from a context-free grammar) to be applied during decoding Context-Free Grammar (CFG): –A formal grammar in which every production rule is of the form V  wV  w where V is a single nonterminal symbol, and w is a string of terminals and/or nonterminals ( w can be empty) –CFG is used to describe the structure of a programming language –A popular notation for CFGs is Backus-Naur Form (BNF) Grammatical Evolution Genetic Programming13

Example: BNF CFG Grammatical Evolution Genetic Programming14 set Id

CFG in BNF: –The symbols belong to one of the two sets ○Terminal set T : Symbols that appear in legal sentences of the CFG ○Nonterminal set N : Symbols that expand into terminals or non- terminals under the application of a set P of production rules –A BNF expresses the CFG as a tuple  N, T, P, S  in which S is a predefined start symbol in N –A BNF CFG provides the mechanism for decoding a genotype into a phenotype Grammatical Evolution Genetic Programming15

Example: Decoding of a chromosome of length l –Begin with the initial expression (i.e., S = ) as the current expression E, and i  1 –Repeat until there is no nonterminal symbol left in E ○Locate the leftmost nonterminal symbol e in E, and k  (i mod l) ○From the rule set R(e) for e, retrieve the production rule p whose id is V k mod |R(e)| where V k is the k th allele (Note that the total number of production rules applied can be either larger than or smaller than l ) ○Update E by expanding e according to p ○ i  i + 1 Grammatical Evolution Genetic Programming16

Example: Decoding of a chromosome of length l Grammatical Evolution Genetic Programming17

Chest-pain diagnosis (Bojarczuk et al., 2000) – 12 diseases, 165 Boolean attributes –Need to derive a Boolean expression for predicting each disease IF (starting factor is emotion) AND ((the pain lasts no more than seconds) OR ((the pain begins gradually) AND (the pain irradiates towards the upper left limb))) THEN (disease is stable angina) – 138 fitness cases collected ○For disease i, cases with the disease are positive examples and those without are negative examples ○ 90 for training and 48 for testing for each disease Example of GP for Knowledge Discovery Genetic Programming18

Chest-pain diagnosis –Primitive set: ○Functions: AND, OR, NOT ○Terminals: the symbols for 165 attributes Example of GP for Knowledge Discovery Genetic Programming19

Chest-pain diagnosis –Test of an expression by fitness cases results in four possible outcomes: ○The true positive rate or sensitivity: ○Specificity: Example of GP for Knowledge Discovery Genetic Programming20 Predicted class YesNo Actual class YesTrue positive ( TP )False negative ( FN ) NoFalse positive ( FP )True negative ( TN )

Chest-pain diagnosis –Simplicity ( Sy ): the measure for the size of a parse tree where maxnodes is the maximum number of nodes allowed and numnodes is the number of nodes of the current parse tree ( 0.5  Sy  1 ) –The fitness function: fitness = Se  Sp  Sy ( 0  fitness  1 ) –GP has shown better predicting performance than other rule- induction algorithms Example of GP for Knowledge Discovery Genetic Programming21