This presentation was covered as part of Divum's New Product Developers Meet held on Apr-8th, 2017. Idea of this presentation is to gently introduce machine learning thinking and expose the tools & options available to get started. This also introduces the Google TensorFlow, Amazon ML & other ML APIs.
2. Data Models Training Predictions
Numbers Equations Solution Builder Apply Solutions
ML Thinking
3. Data
Numbers
ML Thinking - Data
• Real Estate Price Estimator
• #Area
• #Sq.Ft
• Good enough?
• #Bedrooms
• #Years built
4. Models
Equations
ML Thinking - Models
?
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 = 2000
if neighborhood == "domlur":
# but some areas cost a bit more
price_per_sqft = 4000
elif neighborhood == "jayanagar":
# and some areas cost less
price_per_sqft = 10000
# 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 — 200000
else:
# places with more bedrooms are usually
# more valuable
price = price + (num_of_bedrooms * 10000)
return price
6. ML Thinking - Training
Training
Solution Builder
Supervised Training
7. ML Thinking - Training
Training
Solution Builder
Unsupervised Training
Bedrooms Sq.feet Area
2 2000 Domlur
3 3000 Jayanagar
1 1800 NT
4 3000 JP Nagar
Price ?
8. ML Thinking - Training
Training
Solution Builder
Bedrooms Sq.feet Area Sale Price My Guess
2 2000 Domlur ₹40L ₹38L
3 3000 Jayanagar ₹80L ₹90L
1 1800 NT ₹40L ₹30L
4 3000 JP Nagar ₹65L ₹86L
11. ML Thinking - Training
Predictions
Apply Solutions
Bedrooms Sq.feet Area Sale Price Accuracy
2 2000 Domlur ₹39.9L 99%
12. A visual introduction to
machine learning
http://www.r2d3.us/visual-intro-to-
machine-learning-part-1/
Visual Example from bigml.com
13. Programmatic Example - TensorFlow
• The central unit of data in TensorFlow is the tensor
• A tensor consists of a set of primitive values shaped into an array of
any number of dimensions.
• TensorFlow provides multiple APIs (in Python)
14. Programmatic Example - TensorFlow
import numpy as np
import tensorflow as tf
# Model parameters
W = tf.Variable([.3], tf.float32)
b = tf.Variable([-.3], tf.float32)
# Model input and output
x = tf.placeholder(tf.float32)
linear_model = W * x + b
Data Variables
& Equations
15. Programmatic Example - TensorFlow
print(sess.run(linear_model, {x:[1,2,3,4]}))
y = tf.placeholder(tf.float32)
squared_deltas = tf.square(linear_model - y)
loss = tf.reduce_sum(squared_deltas)
print(sess.run(loss, {x:[1,2,3,4], y:[0,-1,-2,-3]}))
fixW = tf.assign(W, [-1.])
fixb = tf.assign(b, [1.])
sess.run([fixW, fixb])
print(sess.run(loss, {x:[1,2,3,4], y:[0,-1,-2,-3]}))
Data
& Run
16. Get started at scale - AWS ML
• You can get started today without ANY programming
• AWS ML works purely based on arbitrary CSV file as input
• Does own modelling, training based on the content shared
• Start predicting in minutes
• Other options are
• Lex, Poly & Rekognition by Amazon
• Vision API, Speech API, Translation API by Google