1 / 24

Genetic Algorithms and Neural Networks

Genetic Algorithms and Neural Networks. MIT Splash 2006 Jack Carrozzo. Applications. GAs need a configuration string/array of data: 01001010, actgtggcata, sdlkdsdflk0flk3ds, 0xdeadbabe…

claral
Download Presentation

Genetic Algorithms and Neural Networks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Genetic Algorithms and Neural Networks MIT Splash 2006 Jack Carrozzo

  2. Applications GAs need a configuration string/array of data: 01001010, actgtggcata, sdlkdsdflk0flk3ds, 0xdeadbabe… Examples: the Traveling Salesman Problem, Puzzles, Mazes, Games (Chess…), problems where you are striving and can get close to a goal

  3. The Golden Function The “Fitness Function” is the deciding factor in using genetic algorithms: if you can’t come up with one, the problem is not solvable by genetics. This function rates a given genetic string by how close it comes to solving the problem or reaching the goal. Bad combinations are weeded out in this way.

  4. Finding Fitness The fitness function describes how far from out goal we are. Say perhaps we’re designing an antenna to be most efficient at 2.54 GHz. If we use positive sorting (wait 5 minutes) and the range/power as our fitness function, successive permutations will lead to antennas with a greater range to power ratio.

  5. The Algorithm If we are searching for a solution set to our problem, we first assign our solution threads random values within our expected range. We sort these in order of their fitness to the problem; the best fit we keep, the next best we split, and the worst we regenerate from random.

  6. On Threads The generally accepted method for threads is to use 4 or 8 on a “standard” sort of problem with one CPU. There are times where we may have many more CPUs, in which case we assign each thread its own processor (16, 32, 64…). Anyone here with a box like that, you are l33t.

  7. Sorting The Threads During each propagation, we run the fitness function on each solution thread, and create a list in order of how well each configuration solves our problem. The sorting can be either negative or positive depending on the problem.

  8. Crossbreeding Let’s say we have 8 solution threads, sorted in order of fitness. A good rule of thumb is to keep the first two, cross the next two, randomly generate half the first and second half of the next two respectively, and finally recreate the final two from scratch (randomly).

  9. The Loop That’s it! Solving GAs is as simple as repeating the previous steps many times until your error or fitness is either a) within a good enough range or b) not changing anymore (no better matches are being found).

  10. A Note on Maxima As you may recall from Calculus, there are two types of maxima: local and absolute. If you only use crossbreeding and half-random recreation (ie, no full random recreation) as your thread modification methods, there is a good chance that you will get stuck at a fairly good solution, but go no higher. Full random threads ensure there is a chance to break out of local minima.

  11. Case Study: Traveling Salesman

  12. Case Study: Poker My solution string was an ugly 240-char array with data defining what the bot would do with a given hand, game options, and recent game history. Had it run for a long time more, it would have done pretty well…

  13. Neural Nets Look at all those pretty circles and lines!

  14. The Parts • Nodes: Keep values to pass to the other nodes, as well as take input or give output. Each node applies the “activation function”. • Links: The connections between nodes. Each link has a specific “weight” that changed the values as they pass to the other node.

  15. The Forward Pass • Set the hidden layer’s values to the sum of each input node multiplied by their perspective weights. • Run the activation function on the hidden nodes. • Do the same from the hidden to output layer.

  16. Or mathematically… V1J=F(S v0i*wiJ)

  17. LOLZ OMG WTF? So… you just ran that, and BOOM you get a number out. Is it what you expected? NO! It’s completely useless… but we aim to fix that ;-)

  18. Training: The Backwards Pass The most-used type of training is called “Back Propagation”, because we calculate the specific error for each node and propagate backwards to fix each layer. This is why we refer to this type of net as “back propagation neural networks”.

  19. Training: Finding Gradients If j is an output node: dj=F’(Vj)(ej) • = expected-actual If j is a hidden node: dj=F’(Vj)(S wjk*dk) F’ is the derivative of the activation function, which is F’(x)=x(x-1)

  20. Training: Fixing the weights The change in each weight, or Dwi, is as follows: Dwi=hxidi And thus the weight update is: wj= wj + Dwj

  21. Architecture: Size, Length How big should your net be? How many hidden layers? Net memory? How much training do you need to do? Data set size? Overtraining?

  22. Simple Test: XOR XOR Truth Table: 0,0  0 0,1  1 1,0  1 1,1  0 (If one and only one input it high, go high, else go low)

  23. Computability With NNs Neural Nets are best used to draw conclusions in data that general mathematics cannot find, and can’t be seen by the human eye: Gold Dig Text to Speech Cameras: finding tanks, driving cross- country Reading Handwriting

  24. w00t Have fun, if you do something awesome (or really, anything at all) I want to hear about it! Thanks Jack Carrozzo jack@crepinc.com

More Related