90 likes | 234 Views
Project 7 Genetic algorithms CS 539. Skyler Whorton November 27, 2012. Data and code. Project 3 datasets revisited Spambase for benchmarking and development purposes (No CFS) Faces for additional results (using CFS 56 pixels ) Genetic Algorithm Neural Network “GANN”
E N D
Project 7GeneticalgorithmsCS 539 SkylerWhortonNovember 27, 2012
Data and code • Project 3 datasets revisited • Spambase for benchmarking and development purposes (No CFS) • Faces for additional results (using CFS 56 pixels) • Genetic Algorithm Neural Network “GANN” • Original extensions to Weka’sMultilayerPerceptronclassifier • Static, user-specified hidden layer topology • Encode and evolve whole network of weights as an individual • Random initial weights as in MultilayerPerceptron • Fitness judged by classification accuracy over training data • Select the half of population with least error for reproduction • Crossover between networks; mutate weights individually, at random • Terminate after G generations, e.g. G=500
Genetic Multilayer Perceptron • (Fixed) hypothesis lengthis a function of network topology • “Genes” are individual weights; “Chromosomes” are networks: • (0.1, 0.5, -0.3, -0.8, … 0.2, -0.7, 0.05, 0.0, 1.2, -0.9) • Initialize new network weights randomly within [-1.0, 1.0] • Generate initial population, P of network “representations” • Fitness: error rate over training data; no backpropogation • Select top 50% of most fit individuals in population i1 0.1 0.5 0.05 o1 h1 -0.3 i2 0.0 F -0.8 … 1.2 h2 o2 0.2 -0.9 im -0.7
Crossover • Sample a pair of representations at a time. • Find random split point resulting in at least 10% exchange • Create and add two offspring from parts of parents. 0.1 0.5 -0.3 -0.8 0.2 -0.7 0.05 0.0 1.2 -0.9 Parents 0.2 -0.1 -0.2 0.6 0.15 -0.2 0.8 0.1 0.3 1.8 0.1 0.5 -0.3 0.6 0.15 -0.2 0.8 0.1 0.3 1.8 Offspring 0.2 -0.1 -0.2 -0.8 0.2 -0.7 0.05 0.0 1.2 -0.9
Mutation • Mutate 10% of individual genes in all offspring, in-place • Apply mutation operators with uniform probability: • Double — W ← W * 2 • Halve — W ← W / 2 • Square— W ← W * W (removed) • Times Ten — W ← W * 10(removed) • Add Random— W ← W + Random(-1.0, 1.0) 0.1 0.5 -0.3 0.6 0.15 -0.2 0.8 0.1 0.3 1.8 Offspring Halve 0.1 0.5 -0.3 0.6 0.15 -0.2 0.4 0.1 0.3 1.8 Mutated
Genetic Programming • Goal: evolve individuals that represent entire programs • Experiment: learn an “interest” function: • A: accumulated moneyincluding interest • P: starting principal money[100, 1000000] • r: interest rate, [0.0, 1.0] • n: number of times tocompound yearly, [1, 12] * P Pow + n 1 / r n Needs to generate and learn a constant value
Genetic Programming • Weka function “GeneticProgramming” classifier (3rd party) • Dataset: generate 1,000 “perfect” random tuples:221269, 0.25, 8, 280296.95(P) (r) (n) (A, computed value) • Options: 1000 generations, limit operators to +, *, /, ^ • Best (sadly) genetic program: vs. LinearRegression: / 1.646 * principal + 707902 * rate + 8224 * compounding + -409163 + 1 2.6 X 105 P RRSE: 56.39% RRSE: 21.51%