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.

Practical Machine Learning

2,453 views

Published on

A rough outline to whet your appetite:

- Get a non-mathematical beginners introduction to machine learning
- See examples of where ML is being used today
- Find out how to identify where ML might be useful in your app
- Find out about selecting “features” for a ML problem
- Prediction.io: why it’s a good solution for developers and how to use it with Ruby
- See results of a recent A/B test using prediction.io on a production application.

Published in: Technology

Practical Machine Learning

  1. 1. Practical Machine Learning David Jones
  2. 2. “Field of study that gives computers the ability to learn without being explicitly programmed” Arthur Samuel, 1959
  3. 3. “Write a program to make this helicopter hover”
  4. 4. Pitch Yaw Roll
  5. 5. helicopter.rb while helicopter.flying if helicopter.pitch < 0 helicopter.pitchBy(0.1) else helicopter.pitchBy(-0.1) end end
  6. 6. helicopter.rb while helicopter.flying if helicopter.pitch < 0 helicopter.pitchBy(0.1) else helicopter.pitchBy(-0.1) end if helicopter.yaw < 0 helicopter.yawBy(0.1) else helicopter.yawBy(-0.1) end end
  7. 7. helicopter.rb while helicopter.flying if helicopter.pitch < 0 helicopter.pitchBy(0.1) else helicopter.pitchBy(-0.1) end if helicopter.yaw < 0 helicopter.yawBy(0.1) else helicopter.yawBy(-0.1) end if helicopter.roll < 0 helicopter.rollBy(0.1) else helicopter.rollBy(-0.1) end end
  8. 8. OK, but what if… • it’s about to hit a tree? • one of the main rotor blades is broken? • power is running low? • there is wind?
  9. 9. What if the helicopter was upside down?
  10. 10. helicopter.rb while helicopter.flying if helicopter.pitch < 0 helicopter.pitchBy(0.1) else helicopter.pitchBy(-0.1) end if helicopter.yaw < 0 helicopter.yawBy(0.1) else helicopter.yawBy(-0.1) end if helicopter.roll < 0 helicopter.rollBy(0.1) else helicopter.rollBy(-0.1) end end Fail
  11. 11. Observe new exception case Write code to handle exception
  12. 12. Helicopter Flying Codebase Helicopter Flying Codebase
  13. 13. You will soon realise you can’t explicitly handle every exception.
  14. 14. “Field of study that gives computers the ability to learn without being explicitly programmed” Arthur Samuel, 1959
  15. 15. Autonomous RC Helicopter Flown using machine learning algorithms
  16. 16. That was 8 years ago… How good is machine learning today?
  17. 17. Germany wins
  18. 18. All 15 match outcomes predicted correctly No “luck” here.
  19. 19. Google Search Netflix Sentiment Analysis Autonomous Cars Spam Detection Face Detection Siri Priority Inbox Medical Diagnosis Advertising Fraud Detection Product Recommendations OCR Dictation Video Games Finance
  20. 20. So, how does it work?
  21. 21. Collect Data Train Model Make Predictions
  22. 22. Two distinct algorithm types • Supervised algorithms • Unsupervised algorithms
  23. 23. Supervised
  24. 24. Supervised Learning Training Data
  25. 25. estimate_sales_price.rb def estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood) price = 0 # In my area, the average house costs $200 per sqft price_per_sqft = 200 if neighborhood == "hipsterton": # but some areas cost a bit more price_per_sqft = 400 elsif neighborhood == "skid row": # and some areas cost less price_per_sqft = 100 end # start with a base price estimate based on how big the place is price = price_per_sqft * sqft # now adjust our estimate based on the number of bedrooms if num_of_bedrooms == 0 # Studio apartments are cheap price = price - 20000 else # places with more bedrooms are usually # more valuable price = price + (num_of_bedrooms * 1000) end price end
  26. 26. estimate_sales_price_ml.rb def estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood) do_some_maths(num_of_bedrooms, sqft, neighborhood) end
  27. 27. estimate_sales_price_ml.rb def estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood) price = 0 # a little pinch of this price += num_of_bedrooms * .841231951398213 # and a big pinch of that price += sqft * 1231.1231231 # maybe a handful of this price += neighborhood * 2.3242341421 # and finally, just a little extra salt for good measure price += 201.23432095 end
  28. 28. estimate_sales_price_ml.rb def estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood) price = 0 # a little pinch of this price += num_of_bedrooms * 1.0 # and a big pinch of that price += sqft * 1.0 # maybe a handful of this price += neighborhood * 1.0 # and finally, just a little extra salt for good measure price += 1.0 end
  29. 29. …500
  30. 30. Square Feet Number of Bedrooms
  31. 31. estimate_sales_price_ml.rb def estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood) price = 0 # a little pinch of this price += num_of_bedrooms * .841231951398213 # and a big pinch of that price += sqft * 1231.1231231 # maybe a handful of this price += neighborhood * 2.3242341421 # and finally, just a little extra salt for good measure price += 201.23432095 end
  32. 32. $300,000
  33. 33. Unsupervised
  34. 34. “Computer, tell me what’s interesting about this data” Training Data
  35. 35. Machine Learning > Explicit Programming
  36. 36. x = sqr feet y = price
  37. 37. Selecting Features
  38. 38. Force applied, weight, colour, wind, material, who threw it, day of week
  39. 39. Force applied, weight, colour, wind, material, who threw it, day of week
  40. 40. Practical Machine Learning How do I use this as a developer?
  41. 41. Algorithm Selection How do I know what algorithm to use?
  42. 42. Algorithm Implementation How do I implement an algorithm? Don’t.
  43. 43. Algorithm Performance Large amounts of training data changing in realtime
  44. 44. Hosting How am I going to run special software required to successfully use ML?
  45. 45. No Data? Start logging today.
  46. 46. ML for Developers So you don’t need to get a PHD in maths
  47. 47. Prediction.IO • Open Source • Deploy on your own servers or instantly on Amazon’s Cloud • Cheap to run • Developer friendly API • Easy to use admin UI
  48. 48. Prediction.IO • Ignore the maths • Helps you find the best algorithm for your problem • Easily hosted and performant • Uses scalable services such as MapReduce and Hadoop. • You don’t need to know how to work this stuff though.
  49. 49. Prediction.IO • Specialises in two use cases • recommendations • similarity • more being added…
  50. 50. Product rating Product views Purchases
  51. 51. Selecting Features
  52. 52. Selecting Features
  53. 53. Selecting Features
  54. 54. Ruby SDK Selecting Features
  55. 55. A/B Test Results • 45% longer average session • 22% increase in conversion rate • 37% increase in average order value • 71% increase in revenue
  56. 56. Machine Learning • Extremely powerful at solving complex problems • Increasingly important for developers to know about it • Don’t need to know the maths to get the benefit
  57. 57. More Information Stanford Machine Learning https://www.coursera.org/course/ml Bootstrapping Machine Learning http://www.louisdorard.com/machine-learning-book/ Machine Learning is Fun https://medium.com/@ageitgey/machine-learning-is-fun- 80ea3ec3c471 Building The Smart Shop http://info.resolvedigital.com/building-the-smart-spree-shop
  58. 58. David Jones @d_jones Questions?

×