Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Evolutionary Algorithms: The Bare Math Behind ...

Medwith
April 07, 2022

Evolutionary Algorithms: The Bare Math Behind Libraries

While not as popular as Neural Networks - Evolutionary Algorithms are also a part of Artificial Intelligence. They help with rapid prototyping, solving optimization problems and hyperparameter optimization for Deep Learning.
I'll show you the bare math behind evolutionary algorithms starting with definitions and finishing with live coding a Genetic Algorithm.
All of this dipped in cheesy jokes and digressions.

Medwith

April 07, 2022
Tweet

More Decks by Medwith

Other Decks in Programming

Transcript

  1. Agenda  What is Artificial Intelligence  Evolutionary Algorithms 

    Genetic Algorithm  Q&A Slides & code will be available to you online
  2. Artificial Intelligence (Artificial Intelligence is) every aspect of learning or

    any other feature of intelligence can in principle be so precisely described that a machine can be made to simulate it. - Dartmouth proposal
  3. Artificial Intelligence Artificial intelligence leverages computers and machines to mimic

    the problem-solving and decision-making capabilities of the human mind. - definition on IBM.com
  4. Evolutionary Algorithms  Genetic algorithms  Genetic programming  Evolutionary

    programming  Evolution strategies  Differential evolution  Neuroevolution  Learning classifier systems
  5. Parents of Evolutionary Algorithms Lawrence J. Fogel John Henry Holland

    Ingo Rechenberg Hans-Paul Schwefel Evolutionary Programming Genetic Algorithm Evolution strategies
  6. Genetic Algorithms  Inspired by natural evolution (natural selection) 

    Used mainly in finding optimal solution for mathematical problems
  7. Genetic Algorithms The 2006 NASA Space Technology 5 spacecraft antenna.

    Its unusual shape was found by an evolutionary computer design program to create the best radiation pattern. Has been „bred” for wide beamwidth for a circularly polarized wave and wide impedance bandwidth to cover the up and down link frequencies at X-band.
  8. Genome (Representation) In nature In computer science 1 0 0

    0 1 1 0 1 This genome codes phenotype that is 141
  9. Population In nature In computer science 1 0 0 0

    1 1 0 1 0 0 1 0 0 0 0 1 1 0 0 1 1 1 1 1 0 0 0 0 1 1 0 1 0 0 0 1 1 1 0 1 0 0 0 0 1 1 1 1
  10. Recombination (Crossover) In nature In computer science 1 1 1

    1 1 1 1 1 0 0 0 0 0 0 0 0 Select recombination point at random
  11. Recombination (Crossover) In nature In computer science 1 1 1

    1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1
  12. Mutation In nature In computer science 1 0 0 0

    1 1 0 1 Each bit in the sequence has a chance to mutate indicated by mutation rate
  13. Other options – Population Elite  Not a standard but

    frequently used.  Given amount of best fit individuals in a population are transfered to the next population without change.  Used to maintain best results.
  14. Genetic Algorithm 1. Prepare fitness function for the problem to

    be solved. 2. Generate a random population. 3. Evaluate each individual’s fitness. 4. Generate new population: 1. (Keep the elite) 2. Breed 3. Mutate 5. Repeat 3-4 until problem is solved.
  15. BGG to the rescue Name Avg. Rating #Plays Owned Wishlist

    Gloomhaven 8735 408892 79584 17935 Scyte 8215 231027 88886 19666 Dune Imperium 8327 48099 26657 8743 Arkham Horror 8160 212148 61705 8775 Viticulture 8052 116080 4384 10375 Tzolk'in 7887 98276 39431 8432 Robinson 7811 98427 59205 11636 … … … … …
  16. Owned-Wishlisted trend 0 5000 10000 15000 20000 25000 6800 26800

    46800 66800 86800 106800 126800 146800 166800 186800 Wishlisted Owned
  17. Linear Regression 𝑓 𝑥 = 𝑎𝑥 + 𝑏 𝑓 𝑥

    - how many times the game was wishlisted 𝑥 – number of bought copies 𝑎, 𝑏 - parameters
  18. Owned-Wishlisted trend 0 5000 10000 15000 20000 25000 6800 26800

    46800 66800 86800 106800 126800 146800 166800 186800 Wishlisted Owned
  19. Owned-Wishlisted trend 0 5000 10000 15000 20000 25000 6800 26800

    46800 66800 86800 106800 126800 146800 166800 186800 Wishlisted Owned
  20. Advantages  Concept is easy to explain and understand. 

    Ready implementation can be easily reused with other problem.  Scales easily in terms of complexity.  Easy to parallelize.  Easy to create multi-objective optimization.  Fitness function is easier then deriveratives. 👍
  21. Limitations  Designing the fitness function can be considered an

    art.  Usually takes longer then bespoke solution.  Some problems require designing bespoke operators. 👎
  22. Summary Like all AI methods Evolutionary Algorithms:  Are prone

    to finding local optimums.  Are as good as your fitness function.  Depend on random values.  Are extremely fun :)
  23. Bibliography  https://speakerdeck.com/medwith/evolutionary-algorithms  https://github.com/Medwith/evolutionary_algorithms_tbmbl  Classic Computer Science Problems

    in Java – David Kopec – Manning  Metody i techniki sztucznej inteligencji – Leszek Rutkowski – PWN  Introduction to Evolutionary Algorithms – Xinjie Yu, Mitsuo Gen – Springer  Evolutionary Algorithms – edited by Eisuke Kita - IntechOpen Limited https://www.intechopen.com/books/98
  24. Image sources  Artificial intelligence brain – from Wikimedia: https://upload.wikimedia.org/wikipedia/commons/7/7a/Anatomy-1751201_1280.png

     Tree of Life – from Wikimedia: https://commons.wikimedia.org/wiki/File:Tree_of_life_int.svg  Parents of Artificial Evolution, courtesy of https://wikipedia.org and https://alchetron.com  DNAand mutation, coutesy of https://wikipedia.org  Crossing-over: https://biol-med.com/2020/10/02/na-czym-polega-proces-crossing-over/  Population of birds: https://upload.wikimedia.org/wikipedia/commons/9/92/Sort_sol_pdfnet.jpg  Bacteria: https://pngset.com/transparent-png#wwqgg  Rulette Wheel - http://www.slotsforsale.com/wp-content/uploads/2019/02/20190219_131138.jpg  Asterix evolution - https://i.pinimg.com/originals/b7/ca/d8/b7cad844e660e6c85289c362b7750740.jpg (Asterix & Obelix belong to Edition Albert-Rene)  Count von Count: https://images.fastcompany.net/image/upload/w_1280,f_auto,q_auto,fl_lossy/wp-cms/uploads/2020/11/poster-stop-the-count-memes.jpg  Random number XKCD comic: https://xkcd.com/221/  Catan photo: https://miro.medium.com/max/4800/1*r_rq_fRLNliX91GSgMi38Q.jpeg  Porky Pig character belongs to Warner Bros.  Robot evolution: https://www.theindianwire.com/wp-content/uploads/2019/06/robot.jpg  1% Germs comic by Isthetie, found here: https://9gag.com/gag/am2j0QV  Swarm gif: https://pl.pinterest.com/pin/377317275022435096/