SlideShare a Scribd company logo
1 of 44
1© Cloudera, Inc. All rights reserved.
Guru Medasani (@gurumedasani)
July 28, 2015
Introduction to Machine
Learning
2© Cloudera, Inc. All rights reserved.
About me
• Current - Sr. Solutions Consultant @Cloudera
• Past -BigData Engineer @Monsanto Research and Development
3© Cloudera, Inc. All rights reserved.
Goals of this talk
• Introduce machine learning
• Get familiar with simple machine learning tools and techniques available.
• Enable you to run linear regression algorithms on datasets at any scale.
4© Cloudera, Inc. All rights reserved.
In this talk
• Machine Learning Motivation
• Machine Learning Definition
• Machine Learning Algorithms
• Linear Regression Motivation
• Linear Regression Deep Dive
• Demo: Linear Regression
5© Cloudera, Inc. All rights reserved.
Machine Learning:
Motivation
6© Cloudera, Inc. All rights reserved.
7© Cloudera, Inc. All rights reserved.
8© Cloudera, Inc. All rights reserved.
9© Cloudera, Inc. All rights reserved.
ML is Applied Everywhere
• Data Mining
• Large datasets from growth of mobile, web, cloud
• E.g., location data, web click data, genomics
• Applications hard to program by hand
• E.g., handwriting recognition, computer vision, natural language processing
• Self-customizing programs
• Netflix, Spotify, Amazon recommendations
• Understanding human learning (brain, real AI)
10© Cloudera, Inc. All rights reserved.
Machine Learning
• In all these applications, it is very hard to write a computer program to perform
these tasks.
• We would like the computer to learn by itself how to perform these various tasks
11© Cloudera, Inc. All rights reserved.
Machine Learning:
Definition
12© Cloudera, Inc. All rights reserved.
Machine Learning: Definition -1
• Arthur Samuel in 1959 described it as:
“ The field of study that gives computers the ability to learn without being
explicitly programmed.”
• This is an older, informal definition
https://en.wikipedia.org/wiki/Machine_learning
13© Cloudera, Inc. All rights reserved.
Machine Learning: Definition -2
• Tom Mitchell in 1998 described a well-posed learning problem as:
“A computer program is said to learn from experience E with respect to some
class of tasks T and performance measure P, if its performance at tasks in T, as
measured by P, improves with Experience E.”
• This is a more modern definition
https://en.wikipedia.org/wiki/Machine_learning
14© Cloudera, Inc. All rights reserved.
Example 1: Spam Detection
• E = Watching you label emails as spam or not spam
• T = Task of classifying emails as spam or not spam
• P = The number (or fraction) of emails correctly classifies as spam/not spam
15© Cloudera, Inc. All rights reserved.
Machine Learning:
Algorithms
16© Cloudera, Inc. All rights reserved.
Types of algorithms
• Supervised learning
• Unsupervised learning
• Others: reinforcement learning, recommender systems
17© Cloudera, Inc. All rights reserved.
Supervised Learning
• Definition (Wikipedia): “Supervised learning is the machine learning task of
inferring a function from labeled training data.”
• Two common examples:
1. Regression: map input variables to some continuous function
2. Classification: map input variables into discrete categories
18© Cloudera, Inc. All rights reserved.
Regression Example:
Given the data about the temperature and
number of bike rentals on various days,
try to predict the number of bike rentals in
the future based on temperature
Temperature in Celsius Number of Bike Rentals
9.84 16
9.02 40
9.84 13
9.02 17
15.58 36
20.10 34
42.10 37
8.2 3
13.12 ??
20.33 ??
19© Cloudera, Inc. All rights reserved.
20© Cloudera, Inc. All rights reserved.
Classification: Example
Given the data about the various
cancer tumor sizes and whether they
are malignant or not, try to predict
if a tumor is benign or malignant
based on tumor size
Tumor Size Malignant (Y/N)?
0 N
1 N
3 N
4 N
5 N
11 Y
13 Y
14 Y
16 ??
17 ??
21© Cloudera, Inc. All rights reserved.
0 (N)
1 (Y)
Tumor Size
Malignant (Y?)
22© Cloudera, Inc. All rights reserved.
Unsupervised Learning
• Definition (Wikipedia): Find hidden structure in unlabeled data.
• Used in exploratory data analysis or as a preprocessing step for supervised task
• Two common examples:
1. Clustering: group set of similar objects in the same group (called a cluster)
2. Dimensionality Reduction: reduce the number of variables or features under
consideration
23© Cloudera, Inc. All rights reserved.
Ok. Lets get to the real stuff
24© Cloudera, Inc. All rights reserved.
Linear Regression:
Motivation
25© Cloudera, Inc. All rights reserved.
Why are we learning linear regression?
It is a crucial technique to learn for many reasons:
• widely used and well-understood
• easy to use because minimal “tuning” is required.
• highly “interpretable”, meaning that it’s easy to explain to others
• basis for many other machine learning techniques
“Importance of having a good understanding of linear regression before studying
more complex methods cannot be overstated”
An Introduction to Statistical Learning – Trevor Hastie, Robert Tibshirani, Gather James and Daniela Witten
26© Cloudera, Inc. All rights reserved.
Linear Regression:
Deep Dive
27© Cloudera, Inc. All rights reserved.
Linear Regression: Model Representation - 1
Data: Housing Prices (Portland, Oregon)
Motivation: Predict the house price given
the size of a house
Supervised Learning – “right answers”
are given for each example in the data set
Regression Problem – predict real-valued output
28© Cloudera, Inc. All rights reserved.
Linear Regression: Model Representation - 2
Housing price data
x’s – “input” variable/features
y’s – “output” variable/ “target” variable
m – number of observations (number of training examples). E.g., m = 4
n – number of input variables/features. E.g., n = 1
(𝑥(𝑖), 𝑦(𝑖)) - 𝑖 𝑡ℎ training example/observation
(𝑥(3)
, 𝑦(3)
) - 3 𝑟𝑑
observation- (2040,314900)
Size of house in square feet (x) Price of house in $ (y)
2104 399900
852 179900
2040 314900
4215 549000
29© Cloudera, Inc. All rights reserved.
Linear Regression: Model Representation - 3
Pipeline for supervised learning
Training Set
Learning Algorithm
h
hypothesis
h maps from x’s to y’s
Size of house Estimated price of house
30© Cloudera, Inc. All rights reserved.
Linear Regression: Model Representation - 4
• Fit a straight line through the data
• Straight line equation
• Univariate linear regression
• x – only one input variable
ℎ 𝜃(x)= 𝜃0+𝜃1x
31© Cloudera, Inc. All rights reserved.
This is very interesting - meow
32© Cloudera, Inc. All rights reserved.
Linear Regression: Model Representation - 5
Hypothesis: ℎ 𝜃(x)= 𝜃0+𝜃1x
𝜃0, 𝜃1 - parameters
But how can we find the right parameters?
Solution:
Find 𝜃0, 𝜃1 such that the ℎ 𝜃(x) is close to
y for given (x, y) training examples
33© Cloudera, Inc. All rights reserved.
Linear Regression: Model Representation - 6
What do we mean by close?
(𝑥(𝑖), ℎ 𝜃(𝑥(𝑖)))
(𝑥(𝑖)
, 𝑦(𝑖)
)
Euclidean distance between above
two points is
𝑑 = (𝑥(𝑖) − 𝑥 𝑖 )2) + (ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2
Squared distance, 𝑑2 = (ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2
34© Cloudera, Inc. All rights reserved.
Linear Regression: Model Representation - 7
• Different 𝜃0, 𝜃1 parameters give different hypothesis
• Our goal is to minimize the squared error distance between predicted values
(hypothesis) ℎ 𝜃(𝑥 𝑖
) and the actual values 𝑦(𝑖)
in our training data set.
• For m training examples, squared error = 𝑖=1
𝑚
(ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2
• Average/Mean Squared Error = 1
𝑚 𝑖=1
𝑚
(ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2
35© Cloudera, Inc. All rights reserved.
Linear Regression: Model Representation -8
• Cost Function / Loss Function 𝐽(𝜃0, 𝜃1)
• Formalize the goal - min
𝜃0,𝜃1
𝐽(𝜃0, 𝜃1)
• This is called Least Squares Regression algorithm
𝐽(𝜃0, 𝜃1) =
1
2𝑚 𝑖=1
𝑚
(ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2
36© Cloudera, Inc. All rights reserved.
Please.. can’t wait to get my hands on this algorithm
37© Cloudera, Inc. All rights reserved.
Linear Regression: Model Recap
• Hypothesis: ℎ 𝜃(x)= 𝜃0+𝜃1x
• Parameters: 𝜃0, 𝜃1
• Cost Function / Loss Function: 𝐽(𝜃0, 𝜃1) =
1
2𝑚 𝑖=1
𝑚
(ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2
• Goal: min
𝜃0,𝜃1
𝐽(𝜃0, 𝜃1)
• Algorithm Name: Least Squares Regression
38© Cloudera, Inc. All rights reserved.
Linear Regression: Solution
• Closed-form Solution:
• Normal Equation Method
• Iterative Solution:
• Batch Gradient Descent
• Stochastic Gradient Descent
39© Cloudera, Inc. All rights reserved.
Linear Regression: Intuition
Training data number of training examples m = 4
number of input features/variables n = 1
𝑋 =
1 2104
1 1600
1 1427
1 1380
𝑦 =
399990
369000
198999
212000
𝜃 =
𝜃0
𝜃1
𝑋 -> 𝑚 × (𝑛 + 1)
𝑦 -> 𝑚 𝑑𝑖𝑚𝑒𝑛𝑠𝑖𝑜𝑛𝑎𝑙 𝑣𝑒𝑐𝑡𝑜𝑟
𝜃 -> 𝑛 + 1 𝑑𝑖𝑚𝑒𝑛𝑠𝑖𝑜𝑛𝑎𝑙 𝑣𝑒𝑐𝑡𝑜𝑟
Size of
house (x)
Price of
house(y)
2104 399990
1600 369000
1427 198999
1380 212000
𝑥0 𝑥1
𝑥0 is a dummy/extra feature.
 ℎ 𝜃(𝑥(1)
)= 𝜃0 𝑥0+𝜃1 𝑥1
 ℎ 𝜃(𝑥(1)
)= 𝜃0 × 1 + 𝜃1 × 𝑥1
 ℎ 𝜃(𝑥(1))= 𝜃0 +𝜃1 𝑥1
40© Cloudera, Inc. All rights reserved.
Linear Regression: Normal Equation
• Cost Function: 𝐽(𝜃0, 𝜃1) =
1
2𝑚 𝑖=1
𝑚
(ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2
• Goal: min
𝜃0,𝜃1
𝐽(𝜃0, 𝜃1)
• Minimization (from calculus)
• Set partial derivatives of cost function 𝐽(𝜃0, 𝜃1) with respect to 𝜃0, 𝜃1 to zero
and solve for 𝜃0, 𝜃1
𝜃 = (𝑋 𝑇 𝑋)−1 𝑋 𝑇 𝑦
41© Cloudera, Inc. All rights reserved.
Lets get to the demo
42© Cloudera, Inc. All rights reserved.
Summary: what we’ve covered so far
• Machine Learning Motivation
• Machine Learning Definition
• Machine Learning Algorithms
• Linear Regression Motivation
• Linear Regression Deep Dive
• Demo: Linear Regression
43© Cloudera, Inc. All rights reserved.
Questions?
44© Cloudera, Inc. All rights reserved.
Thank you
email: gmedasani@cloudera.com
twitter: @gurumedasani

More Related Content

What's hot

Using Deep Learning to Find Similar Dresses
Using Deep Learning to Find Similar DressesUsing Deep Learning to Find Similar Dresses
Using Deep Learning to Find Similar DressesHJ van Veen
 
Entity embeddings for categorical data
Entity embeddings for categorical dataEntity embeddings for categorical data
Entity embeddings for categorical dataPaul Skeie
 
Generative Adversarial Networks : Basic architecture and variants
Generative Adversarial Networks : Basic architecture and variantsGenerative Adversarial Networks : Basic architecture and variants
Generative Adversarial Networks : Basic architecture and variantsananth
 
Introduction of "TrailBlazer" algorithm
Introduction of "TrailBlazer" algorithmIntroduction of "TrailBlazer" algorithm
Introduction of "TrailBlazer" algorithmKatsuki Ohto
 
H2O World - Ensembles with Erin LeDell
H2O World - Ensembles with Erin LeDellH2O World - Ensembles with Erin LeDell
H2O World - Ensembles with Erin LeDellSri Ambati
 
Safe and Efficient Off-Policy Reinforcement Learning
Safe and Efficient Off-Policy Reinforcement LearningSafe and Efficient Off-Policy Reinforcement Learning
Safe and Efficient Off-Policy Reinforcement Learningmooopan
 
Machine learning and_nlp
Machine learning and_nlpMachine learning and_nlp
Machine learning and_nlpankit_ppt
 
Machine Learning Essentials Demystified part1 | Big Data Demystified
Machine Learning Essentials Demystified part1 | Big Data DemystifiedMachine Learning Essentials Demystified part1 | Big Data Demystified
Machine Learning Essentials Demystified part1 | Big Data DemystifiedOmid Vahdaty
 
Multi PPT - Agent Actor-Critic for Mixed Cooperative-Competitive Environments
Multi PPT - Agent Actor-Critic for Mixed Cooperative-Competitive EnvironmentsMulti PPT - Agent Actor-Critic for Mixed Cooperative-Competitive Environments
Multi PPT - Agent Actor-Critic for Mixed Cooperative-Competitive EnvironmentsJisang Yoon
 
Ml10 dimensionality reduction-and_advanced_topics
Ml10 dimensionality reduction-and_advanced_topicsMl10 dimensionality reduction-and_advanced_topics
Ml10 dimensionality reduction-and_advanced_topicsankit_ppt
 
Machine Learning Essentials Demystified part2 | Big Data Demystified
Machine Learning Essentials Demystified part2 | Big Data DemystifiedMachine Learning Essentials Demystified part2 | Big Data Demystified
Machine Learning Essentials Demystified part2 | Big Data DemystifiedOmid Vahdaty
 
Ml9 introduction to-unsupervised_learning_and_clustering_methods
Ml9 introduction to-unsupervised_learning_and_clustering_methodsMl9 introduction to-unsupervised_learning_and_clustering_methods
Ml9 introduction to-unsupervised_learning_and_clustering_methodsankit_ppt
 
Deep learning with TensorFlow
Deep learning with TensorFlowDeep learning with TensorFlow
Deep learning with TensorFlowBarbara Fusinska
 
Gradient Boosted Regression Trees in scikit-learn
Gradient Boosted Regression Trees in scikit-learnGradient Boosted Regression Trees in scikit-learn
Gradient Boosted Regression Trees in scikit-learnDataRobot
 
(141205) Masters_Thesis_Defense_Sundong_Kim
(141205) Masters_Thesis_Defense_Sundong_Kim(141205) Masters_Thesis_Defense_Sundong_Kim
(141205) Masters_Thesis_Defense_Sundong_KimSundong Kim
 
Basics of Machine Learning
Basics of Machine LearningBasics of Machine Learning
Basics of Machine LearningPranav Challa
 
Ot regularization and_gradient_descent
Ot regularization and_gradient_descentOt regularization and_gradient_descent
Ot regularization and_gradient_descentankit_ppt
 
QMIX: monotonic value function factorization paper review
QMIX: monotonic value function factorization paper reviewQMIX: monotonic value function factorization paper review
QMIX: monotonic value function factorization paper review민재 정
 

What's hot (20)

Using Deep Learning to Find Similar Dresses
Using Deep Learning to Find Similar DressesUsing Deep Learning to Find Similar Dresses
Using Deep Learning to Find Similar Dresses
 
ddpg seminar
ddpg seminarddpg seminar
ddpg seminar
 
Entity embeddings for categorical data
Entity embeddings for categorical dataEntity embeddings for categorical data
Entity embeddings for categorical data
 
Generative Adversarial Networks : Basic architecture and variants
Generative Adversarial Networks : Basic architecture and variantsGenerative Adversarial Networks : Basic architecture and variants
Generative Adversarial Networks : Basic architecture and variants
 
Introduction of "TrailBlazer" algorithm
Introduction of "TrailBlazer" algorithmIntroduction of "TrailBlazer" algorithm
Introduction of "TrailBlazer" algorithm
 
Machine learning yearning
Machine learning yearningMachine learning yearning
Machine learning yearning
 
H2O World - Ensembles with Erin LeDell
H2O World - Ensembles with Erin LeDellH2O World - Ensembles with Erin LeDell
H2O World - Ensembles with Erin LeDell
 
Safe and Efficient Off-Policy Reinforcement Learning
Safe and Efficient Off-Policy Reinforcement LearningSafe and Efficient Off-Policy Reinforcement Learning
Safe and Efficient Off-Policy Reinforcement Learning
 
Machine learning and_nlp
Machine learning and_nlpMachine learning and_nlp
Machine learning and_nlp
 
Machine Learning Essentials Demystified part1 | Big Data Demystified
Machine Learning Essentials Demystified part1 | Big Data DemystifiedMachine Learning Essentials Demystified part1 | Big Data Demystified
Machine Learning Essentials Demystified part1 | Big Data Demystified
 
Multi PPT - Agent Actor-Critic for Mixed Cooperative-Competitive Environments
Multi PPT - Agent Actor-Critic for Mixed Cooperative-Competitive EnvironmentsMulti PPT - Agent Actor-Critic for Mixed Cooperative-Competitive Environments
Multi PPT - Agent Actor-Critic for Mixed Cooperative-Competitive Environments
 
Ml10 dimensionality reduction-and_advanced_topics
Ml10 dimensionality reduction-and_advanced_topicsMl10 dimensionality reduction-and_advanced_topics
Ml10 dimensionality reduction-and_advanced_topics
 
Machine Learning Essentials Demystified part2 | Big Data Demystified
Machine Learning Essentials Demystified part2 | Big Data DemystifiedMachine Learning Essentials Demystified part2 | Big Data Demystified
Machine Learning Essentials Demystified part2 | Big Data Demystified
 
Ml9 introduction to-unsupervised_learning_and_clustering_methods
Ml9 introduction to-unsupervised_learning_and_clustering_methodsMl9 introduction to-unsupervised_learning_and_clustering_methods
Ml9 introduction to-unsupervised_learning_and_clustering_methods
 
Deep learning with TensorFlow
Deep learning with TensorFlowDeep learning with TensorFlow
Deep learning with TensorFlow
 
Gradient Boosted Regression Trees in scikit-learn
Gradient Boosted Regression Trees in scikit-learnGradient Boosted Regression Trees in scikit-learn
Gradient Boosted Regression Trees in scikit-learn
 
(141205) Masters_Thesis_Defense_Sundong_Kim
(141205) Masters_Thesis_Defense_Sundong_Kim(141205) Masters_Thesis_Defense_Sundong_Kim
(141205) Masters_Thesis_Defense_Sundong_Kim
 
Basics of Machine Learning
Basics of Machine LearningBasics of Machine Learning
Basics of Machine Learning
 
Ot regularization and_gradient_descent
Ot regularization and_gradient_descentOt regularization and_gradient_descent
Ot regularization and_gradient_descent
 
QMIX: monotonic value function factorization paper review
QMIX: monotonic value function factorization paper reviewQMIX: monotonic value function factorization paper review
QMIX: monotonic value function factorization paper review
 

Viewers also liked

AAPOR 2016 - Robyn Rapoport - Cheaters vs. Good Samaritans
AAPOR 2016 - Robyn Rapoport - Cheaters vs. Good SamaritansAAPOR 2016 - Robyn Rapoport - Cheaters vs. Good Samaritans
AAPOR 2016 - Robyn Rapoport - Cheaters vs. Good SamaritansSSRS Market Research
 
AAPOR 2016 - David Dutwin - Trends in Telephone Outcomes
AAPOR 2016 - David Dutwin - Trends in Telephone OutcomesAAPOR 2016 - David Dutwin - Trends in Telephone Outcomes
AAPOR 2016 - David Dutwin - Trends in Telephone OutcomesSSRS Market Research
 
AeroGear Linecard 2015
AeroGear Linecard 2015AeroGear Linecard 2015
AeroGear Linecard 2015Zenie Noon
 
Position Paper No. 3-Pursuing Government R D Engagements-2
Position Paper No. 3-Pursuing Government R D Engagements-2Position Paper No. 3-Pursuing Government R D Engagements-2
Position Paper No. 3-Pursuing Government R D Engagements-2Tony Mackey
 
Capa de Transporte - Redes de Computadoras
Capa de Transporte - Redes de ComputadorasCapa de Transporte - Redes de Computadoras
Capa de Transporte - Redes de ComputadorasJesus Jimenez
 
WARGA NEGARA KELAS X SMA K13
WARGA NEGARA KELAS X SMA K13WARGA NEGARA KELAS X SMA K13
WARGA NEGARA KELAS X SMA K13akhdi romli
 

Viewers also liked (10)

AAPOR 2016 - Robyn Rapoport - Cheaters vs. Good Samaritans
AAPOR 2016 - Robyn Rapoport - Cheaters vs. Good SamaritansAAPOR 2016 - Robyn Rapoport - Cheaters vs. Good Samaritans
AAPOR 2016 - Robyn Rapoport - Cheaters vs. Good Samaritans
 
AAPOR 2016 - David Dutwin - Trends in Telephone Outcomes
AAPOR 2016 - David Dutwin - Trends in Telephone OutcomesAAPOR 2016 - David Dutwin - Trends in Telephone Outcomes
AAPOR 2016 - David Dutwin - Trends in Telephone Outcomes
 
National beer day
National beer dayNational beer day
National beer day
 
MRA Joint Chapter Conference 2016
MRA Joint Chapter Conference 2016MRA Joint Chapter Conference 2016
MRA Joint Chapter Conference 2016
 
AeroGear Linecard 2015
AeroGear Linecard 2015AeroGear Linecard 2015
AeroGear Linecard 2015
 
Final - HERculues
Final - HERculuesFinal - HERculues
Final - HERculues
 
Favorite girl scout cookies
Favorite girl scout cookiesFavorite girl scout cookies
Favorite girl scout cookies
 
Position Paper No. 3-Pursuing Government R D Engagements-2
Position Paper No. 3-Pursuing Government R D Engagements-2Position Paper No. 3-Pursuing Government R D Engagements-2
Position Paper No. 3-Pursuing Government R D Engagements-2
 
Capa de Transporte - Redes de Computadoras
Capa de Transporte - Redes de ComputadorasCapa de Transporte - Redes de Computadoras
Capa de Transporte - Redes de Computadoras
 
WARGA NEGARA KELAS X SMA K13
WARGA NEGARA KELAS X SMA K13WARGA NEGARA KELAS X SMA K13
WARGA NEGARA KELAS X SMA K13
 

Similar to Ironwood4_Tuesday_Medasani_1PM

Net campus2015 antimomusone
Net campus2015 antimomusoneNet campus2015 antimomusone
Net campus2015 antimomusoneDotNetCampus
 
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATA
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATAPREDICT THE FUTURE , MACHINE LEARNING & BIG DATA
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATADotNetCampus
 
"A Shallow Dive into Training Deep Neural Networks," a Presentation from Deep...
"A Shallow Dive into Training Deep Neural Networks," a Presentation from Deep..."A Shallow Dive into Training Deep Neural Networks," a Presentation from Deep...
"A Shallow Dive into Training Deep Neural Networks," a Presentation from Deep...Edge AI and Vision Alliance
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithmsiqbalphy1
 
Machine Learning with Python- Methods for Machine Learning.pptx
Machine Learning with Python- Methods for Machine Learning.pptxMachine Learning with Python- Methods for Machine Learning.pptx
Machine Learning with Python- Methods for Machine Learning.pptxiaeronlineexm
 
Parallel/Distributed Deep Learning and CDSW
Parallel/Distributed Deep Learning and CDSWParallel/Distributed Deep Learning and CDSW
Parallel/Distributed Deep Learning and CDSWDataWorks Summit
 
Machine Learning Contents.pptx
Machine Learning Contents.pptxMachine Learning Contents.pptx
Machine Learning Contents.pptxNaveenkushwaha18
 
Machine Learning 2 deep Learning: An Intro
Machine Learning 2 deep Learning: An IntroMachine Learning 2 deep Learning: An Intro
Machine Learning 2 deep Learning: An IntroSi Krishan
 
Webinar: Deep Learning Pipelines Beyond the Learning
Webinar: Deep Learning Pipelines Beyond the LearningWebinar: Deep Learning Pipelines Beyond the Learning
Webinar: Deep Learning Pipelines Beyond the LearningMesosphere Inc.
 
Unsupervised Learning: Clustering
Unsupervised Learning: Clustering Unsupervised Learning: Clustering
Unsupervised Learning: Clustering Experfy
 
Amazon SageMaker 內建機器學習演算法 (Level 400)
Amazon SageMaker 內建機器學習演算法 (Level 400)Amazon SageMaker 內建機器學習演算法 (Level 400)
Amazon SageMaker 內建機器學習演算法 (Level 400)Amazon Web Services
 
The Vision & Challenge of Applied Machine Learning
The Vision & Challenge of Applied Machine LearningThe Vision & Challenge of Applied Machine Learning
The Vision & Challenge of Applied Machine LearningCloudera, Inc.
 
Machine Learning, Deep Learning and Data Analysis Introduction
Machine Learning, Deep Learning and Data Analysis IntroductionMachine Learning, Deep Learning and Data Analysis Introduction
Machine Learning, Deep Learning and Data Analysis IntroductionTe-Yen Liu
 
Enterprise Metadata Integration, Cloudera
Enterprise Metadata Integration, ClouderaEnterprise Metadata Integration, Cloudera
Enterprise Metadata Integration, ClouderaNeo4j
 
H2O World - Intro to Data Science with Erin Ledell
H2O World - Intro to Data Science with Erin LedellH2O World - Intro to Data Science with Erin Ledell
H2O World - Intro to Data Science with Erin LedellSri Ambati
 
Machine learning ppt unit one syllabuspptx
Machine learning ppt unit one syllabuspptxMachine learning ppt unit one syllabuspptx
Machine learning ppt unit one syllabuspptxVenkateswaraBabuRavi
 
Big Data Day LA 2015 - Brainwashed: Building an IDE for Feature Engineering b...
Big Data Day LA 2015 - Brainwashed: Building an IDE for Feature Engineering b...Big Data Day LA 2015 - Brainwashed: Building an IDE for Feature Engineering b...
Big Data Day LA 2015 - Brainwashed: Building an IDE for Feature Engineering b...Data Con LA
 

Similar to Ironwood4_Tuesday_Medasani_1PM (20)

Ml ppt at
Ml ppt atMl ppt at
Ml ppt at
 
Net campus2015 antimomusone
Net campus2015 antimomusoneNet campus2015 antimomusone
Net campus2015 antimomusone
 
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATA
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATAPREDICT THE FUTURE , MACHINE LEARNING & BIG DATA
PREDICT THE FUTURE , MACHINE LEARNING & BIG DATA
 
"A Shallow Dive into Training Deep Neural Networks," a Presentation from Deep...
"A Shallow Dive into Training Deep Neural Networks," a Presentation from Deep..."A Shallow Dive into Training Deep Neural Networks," a Presentation from Deep...
"A Shallow Dive into Training Deep Neural Networks," a Presentation from Deep...
 
Data Structure and Algorithms
Data Structure and AlgorithmsData Structure and Algorithms
Data Structure and Algorithms
 
Machine Learning with Python- Methods for Machine Learning.pptx
Machine Learning with Python- Methods for Machine Learning.pptxMachine Learning with Python- Methods for Machine Learning.pptx
Machine Learning with Python- Methods for Machine Learning.pptx
 
Parallel/Distributed Deep Learning and CDSW
Parallel/Distributed Deep Learning and CDSWParallel/Distributed Deep Learning and CDSW
Parallel/Distributed Deep Learning and CDSW
 
Machine Learning Contents.pptx
Machine Learning Contents.pptxMachine Learning Contents.pptx
Machine Learning Contents.pptx
 
Machine Learning 2 deep Learning: An Intro
Machine Learning 2 deep Learning: An IntroMachine Learning 2 deep Learning: An Intro
Machine Learning 2 deep Learning: An Intro
 
Webinar: Deep Learning Pipelines Beyond the Learning
Webinar: Deep Learning Pipelines Beyond the LearningWebinar: Deep Learning Pipelines Beyond the Learning
Webinar: Deep Learning Pipelines Beyond the Learning
 
Unsupervised Learning: Clustering
Unsupervised Learning: Clustering Unsupervised Learning: Clustering
Unsupervised Learning: Clustering
 
pccf unit 1 _VP.pptx
pccf unit 1 _VP.pptxpccf unit 1 _VP.pptx
pccf unit 1 _VP.pptx
 
Amazon SageMaker 內建機器學習演算法 (Level 400)
Amazon SageMaker 內建機器學習演算法 (Level 400)Amazon SageMaker 內建機器學習演算法 (Level 400)
Amazon SageMaker 內建機器學習演算法 (Level 400)
 
The Vision & Challenge of Applied Machine Learning
The Vision & Challenge of Applied Machine LearningThe Vision & Challenge of Applied Machine Learning
The Vision & Challenge of Applied Machine Learning
 
Machine Learning, Deep Learning and Data Analysis Introduction
Machine Learning, Deep Learning and Data Analysis IntroductionMachine Learning, Deep Learning and Data Analysis Introduction
Machine Learning, Deep Learning and Data Analysis Introduction
 
Enterprise Metadata Integration, Cloudera
Enterprise Metadata Integration, ClouderaEnterprise Metadata Integration, Cloudera
Enterprise Metadata Integration, Cloudera
 
Data Science Crash Course
Data Science Crash CourseData Science Crash Course
Data Science Crash Course
 
H2O World - Intro to Data Science with Erin Ledell
H2O World - Intro to Data Science with Erin LedellH2O World - Intro to Data Science with Erin Ledell
H2O World - Intro to Data Science with Erin Ledell
 
Machine learning ppt unit one syllabuspptx
Machine learning ppt unit one syllabuspptxMachine learning ppt unit one syllabuspptx
Machine learning ppt unit one syllabuspptx
 
Big Data Day LA 2015 - Brainwashed: Building an IDE for Feature Engineering b...
Big Data Day LA 2015 - Brainwashed: Building an IDE for Feature Engineering b...Big Data Day LA 2015 - Brainwashed: Building an IDE for Feature Engineering b...
Big Data Day LA 2015 - Brainwashed: Building an IDE for Feature Engineering b...
 

Ironwood4_Tuesday_Medasani_1PM

  • 1. 1© Cloudera, Inc. All rights reserved. Guru Medasani (@gurumedasani) July 28, 2015 Introduction to Machine Learning
  • 2. 2© Cloudera, Inc. All rights reserved. About me • Current - Sr. Solutions Consultant @Cloudera • Past -BigData Engineer @Monsanto Research and Development
  • 3. 3© Cloudera, Inc. All rights reserved. Goals of this talk • Introduce machine learning • Get familiar with simple machine learning tools and techniques available. • Enable you to run linear regression algorithms on datasets at any scale.
  • 4. 4© Cloudera, Inc. All rights reserved. In this talk • Machine Learning Motivation • Machine Learning Definition • Machine Learning Algorithms • Linear Regression Motivation • Linear Regression Deep Dive • Demo: Linear Regression
  • 5. 5© Cloudera, Inc. All rights reserved. Machine Learning: Motivation
  • 6. 6© Cloudera, Inc. All rights reserved.
  • 7. 7© Cloudera, Inc. All rights reserved.
  • 8. 8© Cloudera, Inc. All rights reserved.
  • 9. 9© Cloudera, Inc. All rights reserved. ML is Applied Everywhere • Data Mining • Large datasets from growth of mobile, web, cloud • E.g., location data, web click data, genomics • Applications hard to program by hand • E.g., handwriting recognition, computer vision, natural language processing • Self-customizing programs • Netflix, Spotify, Amazon recommendations • Understanding human learning (brain, real AI)
  • 10. 10© Cloudera, Inc. All rights reserved. Machine Learning • In all these applications, it is very hard to write a computer program to perform these tasks. • We would like the computer to learn by itself how to perform these various tasks
  • 11. 11© Cloudera, Inc. All rights reserved. Machine Learning: Definition
  • 12. 12© Cloudera, Inc. All rights reserved. Machine Learning: Definition -1 • Arthur Samuel in 1959 described it as: “ The field of study that gives computers the ability to learn without being explicitly programmed.” • This is an older, informal definition https://en.wikipedia.org/wiki/Machine_learning
  • 13. 13© Cloudera, Inc. All rights reserved. Machine Learning: Definition -2 • Tom Mitchell in 1998 described a well-posed learning problem as: “A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with Experience E.” • This is a more modern definition https://en.wikipedia.org/wiki/Machine_learning
  • 14. 14© Cloudera, Inc. All rights reserved. Example 1: Spam Detection • E = Watching you label emails as spam or not spam • T = Task of classifying emails as spam or not spam • P = The number (or fraction) of emails correctly classifies as spam/not spam
  • 15. 15© Cloudera, Inc. All rights reserved. Machine Learning: Algorithms
  • 16. 16© Cloudera, Inc. All rights reserved. Types of algorithms • Supervised learning • Unsupervised learning • Others: reinforcement learning, recommender systems
  • 17. 17© Cloudera, Inc. All rights reserved. Supervised Learning • Definition (Wikipedia): “Supervised learning is the machine learning task of inferring a function from labeled training data.” • Two common examples: 1. Regression: map input variables to some continuous function 2. Classification: map input variables into discrete categories
  • 18. 18© Cloudera, Inc. All rights reserved. Regression Example: Given the data about the temperature and number of bike rentals on various days, try to predict the number of bike rentals in the future based on temperature Temperature in Celsius Number of Bike Rentals 9.84 16 9.02 40 9.84 13 9.02 17 15.58 36 20.10 34 42.10 37 8.2 3 13.12 ?? 20.33 ??
  • 19. 19© Cloudera, Inc. All rights reserved.
  • 20. 20© Cloudera, Inc. All rights reserved. Classification: Example Given the data about the various cancer tumor sizes and whether they are malignant or not, try to predict if a tumor is benign or malignant based on tumor size Tumor Size Malignant (Y/N)? 0 N 1 N 3 N 4 N 5 N 11 Y 13 Y 14 Y 16 ?? 17 ??
  • 21. 21© Cloudera, Inc. All rights reserved. 0 (N) 1 (Y) Tumor Size Malignant (Y?)
  • 22. 22© Cloudera, Inc. All rights reserved. Unsupervised Learning • Definition (Wikipedia): Find hidden structure in unlabeled data. • Used in exploratory data analysis or as a preprocessing step for supervised task • Two common examples: 1. Clustering: group set of similar objects in the same group (called a cluster) 2. Dimensionality Reduction: reduce the number of variables or features under consideration
  • 23. 23© Cloudera, Inc. All rights reserved. Ok. Lets get to the real stuff
  • 24. 24© Cloudera, Inc. All rights reserved. Linear Regression: Motivation
  • 25. 25© Cloudera, Inc. All rights reserved. Why are we learning linear regression? It is a crucial technique to learn for many reasons: • widely used and well-understood • easy to use because minimal “tuning” is required. • highly “interpretable”, meaning that it’s easy to explain to others • basis for many other machine learning techniques “Importance of having a good understanding of linear regression before studying more complex methods cannot be overstated” An Introduction to Statistical Learning – Trevor Hastie, Robert Tibshirani, Gather James and Daniela Witten
  • 26. 26© Cloudera, Inc. All rights reserved. Linear Regression: Deep Dive
  • 27. 27© Cloudera, Inc. All rights reserved. Linear Regression: Model Representation - 1 Data: Housing Prices (Portland, Oregon) Motivation: Predict the house price given the size of a house Supervised Learning – “right answers” are given for each example in the data set Regression Problem – predict real-valued output
  • 28. 28© Cloudera, Inc. All rights reserved. Linear Regression: Model Representation - 2 Housing price data x’s – “input” variable/features y’s – “output” variable/ “target” variable m – number of observations (number of training examples). E.g., m = 4 n – number of input variables/features. E.g., n = 1 (𝑥(𝑖), 𝑦(𝑖)) - 𝑖 𝑡ℎ training example/observation (𝑥(3) , 𝑦(3) ) - 3 𝑟𝑑 observation- (2040,314900) Size of house in square feet (x) Price of house in $ (y) 2104 399900 852 179900 2040 314900 4215 549000
  • 29. 29© Cloudera, Inc. All rights reserved. Linear Regression: Model Representation - 3 Pipeline for supervised learning Training Set Learning Algorithm h hypothesis h maps from x’s to y’s Size of house Estimated price of house
  • 30. 30© Cloudera, Inc. All rights reserved. Linear Regression: Model Representation - 4 • Fit a straight line through the data • Straight line equation • Univariate linear regression • x – only one input variable ℎ 𝜃(x)= 𝜃0+𝜃1x
  • 31. 31© Cloudera, Inc. All rights reserved. This is very interesting - meow
  • 32. 32© Cloudera, Inc. All rights reserved. Linear Regression: Model Representation - 5 Hypothesis: ℎ 𝜃(x)= 𝜃0+𝜃1x 𝜃0, 𝜃1 - parameters But how can we find the right parameters? Solution: Find 𝜃0, 𝜃1 such that the ℎ 𝜃(x) is close to y for given (x, y) training examples
  • 33. 33© Cloudera, Inc. All rights reserved. Linear Regression: Model Representation - 6 What do we mean by close? (𝑥(𝑖), ℎ 𝜃(𝑥(𝑖))) (𝑥(𝑖) , 𝑦(𝑖) ) Euclidean distance between above two points is 𝑑 = (𝑥(𝑖) − 𝑥 𝑖 )2) + (ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2 Squared distance, 𝑑2 = (ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2
  • 34. 34© Cloudera, Inc. All rights reserved. Linear Regression: Model Representation - 7 • Different 𝜃0, 𝜃1 parameters give different hypothesis • Our goal is to minimize the squared error distance between predicted values (hypothesis) ℎ 𝜃(𝑥 𝑖 ) and the actual values 𝑦(𝑖) in our training data set. • For m training examples, squared error = 𝑖=1 𝑚 (ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2 • Average/Mean Squared Error = 1 𝑚 𝑖=1 𝑚 (ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2
  • 35. 35© Cloudera, Inc. All rights reserved. Linear Regression: Model Representation -8 • Cost Function / Loss Function 𝐽(𝜃0, 𝜃1) • Formalize the goal - min 𝜃0,𝜃1 𝐽(𝜃0, 𝜃1) • This is called Least Squares Regression algorithm 𝐽(𝜃0, 𝜃1) = 1 2𝑚 𝑖=1 𝑚 (ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2
  • 36. 36© Cloudera, Inc. All rights reserved. Please.. can’t wait to get my hands on this algorithm
  • 37. 37© Cloudera, Inc. All rights reserved. Linear Regression: Model Recap • Hypothesis: ℎ 𝜃(x)= 𝜃0+𝜃1x • Parameters: 𝜃0, 𝜃1 • Cost Function / Loss Function: 𝐽(𝜃0, 𝜃1) = 1 2𝑚 𝑖=1 𝑚 (ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2 • Goal: min 𝜃0,𝜃1 𝐽(𝜃0, 𝜃1) • Algorithm Name: Least Squares Regression
  • 38. 38© Cloudera, Inc. All rights reserved. Linear Regression: Solution • Closed-form Solution: • Normal Equation Method • Iterative Solution: • Batch Gradient Descent • Stochastic Gradient Descent
  • 39. 39© Cloudera, Inc. All rights reserved. Linear Regression: Intuition Training data number of training examples m = 4 number of input features/variables n = 1 𝑋 = 1 2104 1 1600 1 1427 1 1380 𝑦 = 399990 369000 198999 212000 𝜃 = 𝜃0 𝜃1 𝑋 -> 𝑚 × (𝑛 + 1) 𝑦 -> 𝑚 𝑑𝑖𝑚𝑒𝑛𝑠𝑖𝑜𝑛𝑎𝑙 𝑣𝑒𝑐𝑡𝑜𝑟 𝜃 -> 𝑛 + 1 𝑑𝑖𝑚𝑒𝑛𝑠𝑖𝑜𝑛𝑎𝑙 𝑣𝑒𝑐𝑡𝑜𝑟 Size of house (x) Price of house(y) 2104 399990 1600 369000 1427 198999 1380 212000 𝑥0 𝑥1 𝑥0 is a dummy/extra feature.  ℎ 𝜃(𝑥(1) )= 𝜃0 𝑥0+𝜃1 𝑥1  ℎ 𝜃(𝑥(1) )= 𝜃0 × 1 + 𝜃1 × 𝑥1  ℎ 𝜃(𝑥(1))= 𝜃0 +𝜃1 𝑥1
  • 40. 40© Cloudera, Inc. All rights reserved. Linear Regression: Normal Equation • Cost Function: 𝐽(𝜃0, 𝜃1) = 1 2𝑚 𝑖=1 𝑚 (ℎ 𝜃(𝑥 𝑖 ) − 𝑦(𝑖))2 • Goal: min 𝜃0,𝜃1 𝐽(𝜃0, 𝜃1) • Minimization (from calculus) • Set partial derivatives of cost function 𝐽(𝜃0, 𝜃1) with respect to 𝜃0, 𝜃1 to zero and solve for 𝜃0, 𝜃1 𝜃 = (𝑋 𝑇 𝑋)−1 𝑋 𝑇 𝑦
  • 41. 41© Cloudera, Inc. All rights reserved. Lets get to the demo
  • 42. 42© Cloudera, Inc. All rights reserved. Summary: what we’ve covered so far • Machine Learning Motivation • Machine Learning Definition • Machine Learning Algorithms • Linear Regression Motivation • Linear Regression Deep Dive • Demo: Linear Regression
  • 43. 43© Cloudera, Inc. All rights reserved. Questions?
  • 44. 44© Cloudera, Inc. All rights reserved. Thank you email: gmedasani@cloudera.com twitter: @gurumedasani

Editor's Notes

  1. Talk about what I do at Cloudera Talk about what I did at Monsanto
  2. 1) Just mention the points and don’t go into details
  3. When we use search engines like google and bing, reason we get the right results is that their machine learning algorithms have figured out how to best rank the pages to display them to you
  4. 1) When you use gmail or yahoo or any mail program, your program is able to detect the spam and junk because algorithm has figured out which emails to be classified as spam and which emails are classified as not spam.
  5. Squared distance or Squared error