practical machine learning
DESCRIPTION
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.TRANSCRIPT
![Page 1: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/1.jpg)
Practical Machine LearningDavid Jones
![Page 2: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/2.jpg)
“Field of study that gives computers the ability to learn without being explicitly programmed”
Arthur Samuel, 1959
![Page 3: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/3.jpg)
“Write a program to make this helicopter hover”
![Page 4: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/4.jpg)
Pitch
Yaw
Roll
![Page 5: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/5.jpg)
helicopter.rb
while helicopter.flying
if helicopter.pitch < 0 helicopter.pitchBy(0.1) else helicopter.pitchBy(-0.1) end
end
![Page 6: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/6.jpg)
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
![Page 7: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/7.jpg)
helicopter.rbwhile 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
![Page 8: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/8.jpg)
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?
![Page 9: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/9.jpg)
What if the helicopter was upside down?
![Page 10: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/10.jpg)
helicopter.rbwhile 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
![Page 11: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/11.jpg)
Observe new exception case
Write code to handle exception
![Page 12: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/12.jpg)
Helicopter Flying CodebaseHelicopter Flying Codebase
![Page 13: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/13.jpg)
You will soon realise you can’t explicitly handle every
exception.
![Page 14: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/14.jpg)
“Field of study that gives computers the ability to learn without being explicitly programmed”
Arthur Samuel, 1959
![Page 15: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/15.jpg)
Autonomous RC HelicopterFlown using machine learning algorithms
![Page 16: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/16.jpg)
That was 8 years ago…How good is machine learning today?
![Page 17: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/17.jpg)
![Page 18: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/18.jpg)
Germany wins
![Page 19: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/19.jpg)
All 15 match outcomes predicted correctlyNo “luck” here.
![Page 20: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/20.jpg)
Google SearchNetflix
Face DetectionSpam Detection
Medical Diagnosis AdvertisingFraud Detection
Product Recommendations
Siri
OCR
Priority Inbox
Dictation
Autonomous Cars
Video Games
Finance
Sentiment Analysis
![Page 21: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/21.jpg)
So, how does it work?
![Page 22: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/22.jpg)
Collect Data
Train Model
Make Predictions
![Page 23: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/23.jpg)
![Page 24: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/24.jpg)
Two distinct algorithm types• Supervised algorithms
• Unsupervised algorithms
![Page 25: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/25.jpg)
Supervised
![Page 26: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/26.jpg)
Supervised Learning
Trai
ning
Dat
a
![Page 27: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/27.jpg)
estimate_sales_price.rbdef 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
priceend
![Page 28: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/28.jpg)
estimate_sales_price_ml.rbdef estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood) do_some_maths(num_of_bedrooms, sqft, neighborhood)end
![Page 29: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/29.jpg)
estimate_sales_price_ml.rbdef 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.23432095end
![Page 30: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/30.jpg)
estimate_sales_price_ml.rbdef 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.0end
![Page 31: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/31.jpg)
…500
![Page 32: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/32.jpg)
Square Feet
Number of Bedrooms
![Page 33: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/33.jpg)
estimate_sales_price_ml.rbdef 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.23432095end
![Page 34: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/34.jpg)
$300,000
![Page 35: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/35.jpg)
Unsupervised
![Page 36: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/36.jpg)
“Computer, tell me what’s interesting about this data”
Trai
ning
Dat
a
![Page 37: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/37.jpg)
Machine Learning>
Explicit Programming
![Page 38: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/38.jpg)
x = sqr feety = price
![Page 39: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/39.jpg)
Selecting Features
![Page 40: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/40.jpg)
Force applied, weight, colour, wind, material, who threw it, day of week
![Page 41: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/41.jpg)
Force applied, weight, colour, wind, material, who threw it, day of week
![Page 42: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/42.jpg)
Practical Machine LearningHow do I use this as a developer?
![Page 43: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/43.jpg)
Algorithm SelectionHow do I know what algorithm to use?
![Page 44: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/44.jpg)
Algorithm ImplementationHow do I implement an algorithm? Don’t.
![Page 45: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/45.jpg)
Algorithm PerformanceLarge amounts of training data changing in
realtime
![Page 46: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/46.jpg)
HostingHow am I going to run special software
required to successfully use ML?
![Page 47: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/47.jpg)
No Data?Start logging today.
![Page 48: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/48.jpg)
![Page 49: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/49.jpg)
ML for DevelopersSo you don’t need to get a PHD in maths
![Page 50: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/50.jpg)
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
![Page 51: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/51.jpg)
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.
![Page 52: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/52.jpg)
Prediction.IO• Specialises in two use cases
• recommendations
• similarity
• more being added…
![Page 53: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/53.jpg)
Product ratingProduct viewsPurchases
![Page 54: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/54.jpg)
![Page 55: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/55.jpg)
Selecting Features
![Page 56: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/56.jpg)
Selecting Features
![Page 57: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/57.jpg)
Selecting Features
![Page 58: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/58.jpg)
Selecting Features
Ruby SDK
![Page 59: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/59.jpg)
![Page 60: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/60.jpg)
A/B Test Results• 45% longer average session
• 22% increase in conversion rate
• 37% increase in average order value
• 71% increase in revenue
![Page 61: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/61.jpg)
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
![Page 62: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/62.jpg)
More InformationStanford 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 Shophttp://info.resolvedigital.com/building-the-smart-spree-shop
![Page 63: Practical Machine Learning](https://reader033.vdocuments.us/reader033/viewer/2022052900/55627264d8b42a0d398b4727/html5/thumbnails/63.jpg)
David Jones@d_jones
Questions?