Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Learning Machine Learning

431 views

Published on

From chatbots to your home thermostat, it seems like machine learning algorithms are everywhere nowadays. How about understanding how this works now? In this talk, you will learn about the basics of machine learning through various basic examples, without the need for a PhD or deep knowledge of assembly. At the end of this talk, you will know what the Naive Bayes classifiers, sentiment analysis and basic genetic algorithms are and how they work. You will also see how to create your own implementations in PHP.

Published in: Internet
  • Be the first to comment

  • Be the first to like this

Learning Machine Learning

  1. 1. Learning Machine Learning A little intro to a (not that complex) world
  2. 2. @joel__lord #LonestarPHP About Me
  3. 3. @joel__lord #LonestarPHP Our Agenda for today… • AI vs ML • Deep Learning & Neural Networks • Supervised vs unsupervised • Naïve Bayes Classifier • Genetic Algorithms
  4. 4. @joel__lord #LonestarPHP
  5. 5. @joel__lord #LonestarPHP Artificial Intelligence Artificial intelligence (AI) is intelligence exhibited by machines. In computer science, the field of AI research defines itself as the study of "intelligent agents": any device that perceives its environment and takes actions that maximize its chance of success at some goal.
  6. 6. @joel__lord #LonestarPHP Artificial Intelligence “takes actions that maximize its chance of success at some goal”
  7. 7. @joel__lord #LonestarPHP Examples in real life
  8. 8. @joel__lord #LonestarPHP Machine Learning Machine learning (ML) is the subfield of computer science that gives "computers the ability to learn without being explicitly programmed."
  9. 9. @joel__lord #LonestarPHP
  10. 10. @joel__lord #LonestarPHP
  11. 11. @joel__lord #LonestarPHP
  12. 12. @joel__lord #LonestarPHP
  13. 13. @joel__lord #LonestarPHP
  14. 14. @joel__lord #LonestarPHP “Don’t be afraid of artificial intelligence, be afraid of humanity.”
  15. 15. @joel__lord #LonestarPHP Deep Learning & Big Data • Explosion of digital data • Can’t be processed with traditional methods anymore
  16. 16. @joel__lord #LonestarPHP Neural Networks • Breaking big problems in small layers
  17. 17. @joel__lord #LonestarPHP Supervised Learning • Requires feedback • Starts with nothing and increases its understanding • Useless if the data is of bad quality • Use cases: • Classification
  18. 18. @joel__lord #LonestarPHP Unsupervised Learning • There is no feedback • Good in the case of no right or wrong answer • Helps to identify patterns or data structures • Use case: • You might also be interested in… • Grouping customers by purchasing behaviors
  19. 19. @joel__lord #LonestarPHP The Naïve Bayes Classifier
  20. 20. @joel__lord #LonestarPHP Bayes Theorem • 𝑃 𝐴 𝐵 = % 𝐴 𝐵 % & % '
  21. 21. @joel__lord #LonestarPHP Bayes Theorem • 𝑃 𝐴 𝐵 = % 𝐵 𝐴 % & % 𝐵 𝐴 % & ( )*% 𝐵 𝐴 )*% &
  22. 22. @joel__lord #LonestarPHP Bayes Theorem • 𝑃 𝐴 𝐵 = ∏ % 𝐴 𝑊- . /01 ∏ % 𝐴 𝑊- . /01 ( ∏ )*% 𝐴 𝑊- . /01
  23. 23. @joel__lord #LonestarPHP Bayes Theorem • 𝑃 𝐴 𝐵 = 𝑊2∱
  24. 24. @joel__lord #LonestarPHP Naive Bayes Classifier • Let’s look at a concrete example. • You never know what you’re gonna get
  25. 25. @joel__lord #LonestarPHP Probability that a chocolate has nuts Nuts No Nuts Round 25% 75% Square 75% 25% Dark 10% 90% Light 90% 10%
  26. 26. @joel__lord #LonestarPHP Do round, light chocolates have nuts? Nuts No Nuts Round 25% 75% 0.25 0.75 Square 75% 25% - - Dark 10% 90% - - Light 90% 10% 0.9 0.1
  27. 27. @joel__lord #LonestarPHP Do round, light chocolates have nuts? Nuts No Nuts Round 25% 75% 0.25 0.75 Square 75% 25% - - Dark 10% 90% - - Light 90% 10% 0.9 0.1 4 𝑷𝒊 𝒏 𝒊8𝟏 0.225 0.075
  28. 28. @joel__lord #LonestarPHP Do round, light chocolates have nuts? Nuts No Nuts Round 25% 75% 0.25 0.75 Square 75% 25% - - Dark 10% 90% - - Light 90% 10% 0.9 0.1 4 𝑷𝒊 𝒏 𝒊8𝟏 0.225 0.075 𝑃 🌰 = 0.225 0.225 + 0.075 = 0.75 = 75%
  29. 29. @joel__lord #LonestarPHP Naïve Bayes Classifier in code var Classifier = function() { this.dictionaries = {}; }; Classifier.prototype.classify = function(text, group) { }; Classifier.prototype.categorize = function(text) { };
  30. 30. @joel__lord #LonestarPHP
  31. 31. @joel__lord #LonestarPHP Sentiment Analysis • Not Machine Learning • Uses classifiers and AFINN-165 (and emojis)
  32. 32. @joel__lord #LonestarPHP Sentiment Analysis • Javascript: • npm install sentiment • PHP: • composer require risan/sentiment- analysis
  33. 33. @joel__lord #LonestarPHP Genetic Algorithm • Awesome shit!
  34. 34. @joel__lord #LonestarPHP Genetic Algorithm • Create a population of random individuals • Keep the closest individuals • Keep a few random individuals • Introduce random mutations • Randomly create ”children” • Magically end up with a valid solution
  35. 35. @joel__lord #LonestarPHP Genetic Algorithm • Create a population of random individuals • Keep the closest individuals • Keep a few random individuals • Introduce random mutations • Randomly create ”children” • Magically end up with a valid solution
  36. 36. @joel__lord #LonestarPHP Genetic Algorithm Credit: AutoDesk https://autodeskresearch.com/projects/Dreamcatcher
  37. 37. @joel__lord #LonestarPHP https://www.youtube.com/watch?v=yci5FuI1ovk
  38. 38. @joel__lord #LonestarPHP Genetic Algorithm in code //Declare Consts function randomInt(min, max) {…} function random(min, max) {…} function fitness(individual) {…} function sortByFitness(population) {…} function randomIndividual() {…} function randomPopulation(size) {…} function mutate(population) {…} function reproduce(father, mother) {…} function evolve(population) {…} function findSolution() { var population = randomPopulation(POP_SIZE); var generation = 0; while (fitness(population[0]) > CLOSE_ENOUGH) { generation++; population = evolve(population); } return {solution: population[0], generations: generation}; } var sol = findSolution();
  39. 39. @joel__lord #LonestarPHP What did we learn? • Machine Learning and Artificial Intelligence • Big Data and Deep Learning • Supervised vs unsupervised • Basic Algorithms • Naïve Bayes Classifier • Sentiment Analysis • Genetic Algorithm • Hopefully, you don’t feel intimidated by ML anymore
  40. 40. Presented By JOEL LORD Lone Star PHP, April 23rd 2017 @joel__lord joellord Thank you
  41. 41. Presented By JOEL LORD Lone Star PHP, April 23rd 2017 @joel__lord joellord Questions?
  42. 42. Impact of parameters on Genetic Algorithms

×