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

Monkeys in the Machine

Monkeys in the Machine

Can a million monkeys given a million typewriters produce the collected works of Shakespeare? Considering the ethical concerns of forcing monkeys to write, paired with the sheer mess of that many mammals in one location, we might never know. Or will we?

Thanks to the wonders of modern computing, it's possible to _simulate_ monkeys emulating the Bard. Leveraging techniques like genetic algorithms, we can build a system that approximates a monkey armed with a typewriter. Digitally.

It's a fun exercise to prove a thought experiment, but also a powerful technical approach to leverage machine learning and rudimentary AI in various places. Together, we'll breed digital monkeys and show both how they can be used to answer the aforementioned Shakespearean question as well as produce generative results to more _practical_ problems.

Eric Mann

March 17, 2020
Tweet

More Decks by Eric Mann

Other Decks in Technology

Transcript

  1. 3 Concevons qu'on ait dressé un million de singes à

    frapper au hasard sur les touches d'une machine à écrire et que […] ces singes dactylographes travaillent avec ardeur dix heures par jour avec un million de machines à écrire de types variés. […] Au bout d'un an, [leurs] volumes se trouveraient renfermer la copie exacte des livres de toute nature et de toutes langues conservés dans les plus riches bibliothèques du monde. — Émile Borel
  2. 4 Let us imagine that a million monkeys have been

    trained to strike at random on the keys of a typewriter and that […] these typing monkeys work hard ten hours a day with a million typewriters of various types. […] At the end of a year, [their] volumes would find themselves containing the exact copy of books of all kinds and all languages kept in the richest libraries in the world. — Émile Borel (via Google Translate)
  3. 5

  4. 6 CREATE POPULATION EVALUATE FITNESS MUTATE REPRODUCE Randomly-initialized strings can

    eventually converge to meet a target string over several iterations of a random optimization algorithm over a large set of candidates. Evaluate how close each candidate is to the optimum Evaluate Fitness Initialize a collection of pseudrandom candidates Create Population Create a new candidate for the next generation Reproduce Mutate the new candidate so we can further optimize Mutate Genetic Algorithms
  5. 9 Genetic Algorithms In Review 1 We created a collection

    of entirely random strings, all the same length as our target text. Initialize Population 2 We measured the distance of each string from the target text. Evaluate Fitness 3 We used our “high fitness” members to create a new, somewhat less random child generation Reproduce 4 We mutated some children to introduce randomness and prevent local maxima. Mutate
  6. 10 The Traveling Salesman Problem Salesman must travel to all

    cities once before returning home. The distance between each city is given and is assumed to be the same in either direction. OBJECTIVE - Minimize the total distance traveled on the trip.
  7. 12 Genetic Algorithms Traveling Salesman 1 Create a “population” of

    randomly-ordered strings representing a route. Initialize Population 2 Measure the total distance traveled while traversing each route. Evaluate Fitness 3 We used our “high fitness” members to create a new, somewhat less random child generation Reproduce 4 Mutate by swapping the order of two cities in the route. Mutate
  8. 15 Ant Colony Optimization Traveling Salesman 1 Drop an “ant”

    at a random city. Random Starting Point 2 The ant visits each city in turn at random, weighted by the attractiveness of each destination. “Attractiveness”-based Route 3 An ant deposits pheromone on each edge it travels, with an amount inversely proportional to the total distance travelled in its route. Calculate Pheromone Trail 4 The total pheromone for the next iteration is part left over from the first and part added to by the ants - repeat all steps until we converge. Evaporate and Repeat
  9. 17 Ant Colony Optimization Traveling Salesman Vehicle Routing Job Ordering

    “Knapsack Problem” Nanoelectronics Design Image Processing Antenna Optimization Network Routing Protein Folding