SlideShare a Scribd company logo
Lesson 4
Supervised Learning
2
Legal Disclaimers
No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by
this document.
Intel technologies’ features and benefits depend on system configuration and may require enabled
hardware, software or service activation. Performance varies depending on system configuration. Check
with your system manufacturer or retailer or learn more at intel.com.
Intel disclaims all express and implied warranties, including without limitation, the implied warranties of
merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising
from course of performance, course of dealing, or usage in trade.
Copies of documents which have an order number and are referenced in this document may be obtained
by calling 1-800-548-4725 or by visiting www.intel.com/design/literature.htm.
Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries.
*Other names and brands may be claimed as the property of others
Copyright © 2018 Intel Corporation. All rights reserved.
3
Learning Objectives
• Name the steps in the data science workflow
• Explain how to formulate a supervised learning problem
• Compare “Training” and “Inference”
• Describe the dangers of overfitting, and training vs. testing data
• Identify the advantages of the PyData* ecosystem
You will be able to:
*Other names and brands may be claimed as the property of others.
5
Machine Learning
The study and construction of programs that learn from repeatedly seeing data,
rather than being explicitly programmed by humans.
Data points have
known outcome
Supervised
Learning
Unsupervised
Learning
Dataset
Data points have
unknown outcome
Type
6
Target vs. Features
TargetFeatures
Target: Column to predict
Features: Properties of the data used for prediction (non-target columns)
Example: Supervised Learning Problem
NOT SPAM?
Supervised
Learning
Program
SPAM?
Goal: Predict if an email is spam or not spam.
Data: Historical emails labeled as spam or not spam.
Target: Spam or not spam
Features: Email text, subject, time sent, etc.
Example: Supervised Learning Problem
Goal: Predict location of bounding box
around an object.
Data: Images with bounding box locations.
Target: Corners of bounding box
Features: Image pixels
10
Data Science Workflow
Problem Statement
Data Collection
Data Exploration
& Preprocessing
Modeling
Validation
Decision Making
& Deployment
What problem are you trying to solve?
What data do you need to solve it?
How should you clean your data so your model can use it?
Build a model to solve your problem?
Did I solve the problem?
Communicate to stakeholders or put into production?
11
This Lesson’s Focus: Modeling and Validation
Problem Statement
Data Collection
Data Exploration
& Preprocessing
Modeling
Validation
Decision Making
& Deployment
What problem are you trying to solve?
What data do you need to solve it?
How should you clean your data so your model can use it?
Build a model to solve your problem?
Did I solve the problem?
Communicate to stakeholders or put into production?
Formulating a Supervised Learning Problem
13
For a Supervised Learning Problem:
• Collect a labeled dataset (features and target labels).
• Choose the model.
• Choose an evaluation metric:
“What to use to measure performance.”
• Choose an optimization method:1
“How to find the model configuration that gives the best performance.”
1There are standard methods to use for different models and metrics.
Decision tree
Which Model?
14
There are many models that represent the problem and make decisions in
different ways each with their own advantages and disadvantages.
A decision tree makes predictions by asking a series of yes/no questions.
Nearest neighbor makes predictions by having the most similar examples vote.
Nearest neighbors
Which Model?
15
Some considerations when choosing are:
• Time needed for training
• Speed in making predictions
• Amount of data needed
• Type of data
• Problem complexity
• Ability to solve a complex problem
• Tendency to overcomplicate a simple one
Accuracy target
Evaluation Metric
16
There are many metrics available1 to measure performance,
such as:
• Accuracy: how well predictions match true values.
• Mean Squared Error: average square distance
between prediction and true value.
1The wrong metric can be misleading or not capture the real problem.
Mean square error formula
Evaluation Metric
17
Email
The wrong metric can be misleading or not capture the real problem.
For example: consider using accuracy for spam/not spam.
• If 99 out of 100 emails are actually spam, then a model that is predicting
spam every time will have 99% accuracy.
• This may force an important real email into spam,
even though it has a high accuracy metric.
Training
18
Training Data: The dataset used to train the model.
Optimization: Configures the model for best performance.
?
Error
Training
19
Forward
Backward
“Bicycle!” “Strawberry?”
Human
Bicycle
Strawberry
With these pieces, a model can now be trained to find the best configuration.
Labeled Data Model Evaluation Metric
Inference
20
Once the model is trained, we can provide new examples for predictions.
??????
“Bicycle!”
ModelNew Data Prediction
Training vs. Inference
21
Goal: Perform well on unseen data during inference.
??????
“Bicycle!”
?
Error
“Bicycle!” “Strawberry?”
Human
Bicycle
Strawberry
Model
weights
TrainingInference
Supervised Learning Overview
22
Data with answers
(features and labels)
Model+ Trained
Model
Fit
Data without answers
(features only)
Trained
Model
+ Predicted
Answer
Predict
Training: Train a model with known data.
Inference: Feed unseen data into trained model to make predictions.
Curve Fitting: Overfitting vs. Underfitting Example
24
X
Y
Goal: Fit a curve to the data.
X
Y
Curve Fitting: Underfitting Example
25
The curve can be too simple.
• This is called “underfitting”
• Poor fit on training data
• Poor fit on unseen data
Underfitting: Model is missing systematic
trends in data.
X
Y
Curve Fitting: Overfitting Example
26
The curve can be too complex.
• This is called “overfitting”
• Good fit on training data
• Poor fit on unseen data
Overfitting: Model is too sensitive
and fits the “noise” in the training data.
Curve Fitting Problem
27
Problem: Unseen data isn’t available during training.
• How can performance be estimated?
When measuring performance on the training data, there is a tendency to overfit.
Underfit Well fit Overfit
28
Solution: Split Data Into Two Sets
Training Set
Testing Set
Training Set: Data used during the training process.
Test Set: Data used to measure performance, simulating unseen data1.
1 Not used during the training process.
*Other names and brands may be claimed as the property of others.
29
Train-Test Split
Model Weights
Training Data
Testing Data
Evaluate trained model on data it hasn’t “seen” before
to simulate real-world inference.
“Trained Model”
Training
Inference
Prediction
*Other names and brands may be claimed as the property of others.
31
Why Python*?
• General purpose language.
• Simple, readable syntax relative to other languages, such as Java* or C++.
• Has a good REPL.
• Can facilitate applications written in other languages, C++ and Fortran.
• Active community.
• Extensive libraries.
*Other names and brands may be claimed as the property of others.
32
Python*: Fastest Growing Programming Language1
1Source:
Stack Overflow
*Other names and brands may be claimed as the property of others.
33
Python*: Highest Ranked Language1
1Source:
IEEE Spectrum
*Other names and brands may be claimed as the property of others.
34
Python* Libraries for Data Science
Fast numerical computing Data analysis and manipulation
Machine learning Visualization
Deep Learning
*Other names and brands may be claimed as the property of others.
Intel® Distribution for Python*
Easy, Out-of-the-box Access to High Performance Python*
• Prebuilt, optimized for numerical computing, data analytics, High
Performance Computing (HPC).
• Drop in replacement for your existing Python (no code changes required).
• Download from https://software.intel.com/en-us/distribution-for-python
*Other names and brands may be claimed as the property of others.
Intel® Distribution for Python*
Drive Performance with Multiple Optimization Techniques
• Accelerated NumPy/ SciPy / Scikit-Learn with the Intel® Math Kernel
Library (Intel® MKL).
• Data analytics with pyDAAL, enhanced thread scheduling with Intel®
Thread Building Blocks (Intel® TBB), Jupyter* Notebook interface,
Numba, Cython*.
• Scale easily with optimized MPI4Py* and Jupyter* notebooks.
*Other names and brands may be claimed as the property of others.
Intel® Distribution for Python*
Faster Access to Latest Optimizations for Intel® Architecture
• Distribution and individual optimized packages available
through Conda* and Anaconda Cloud*.
• Optimizations upstreamed back to main Python* trunk.
*Other names and brands may be claimed as the property of others.
Train and Test Splitting: Syntax
Import the train and test split function.
from sklearn.model_selection import train_test_split
Split the data and put 30% into the test set.
train, test = train_test_split(data, test_size=0.3)
Other method for splitting data.
from sklearn.model_selection import ShuffleSplit
Import the class containing the classification method.
from sklearn.neighbors import KNeighborsClassifier
Create an instance of the class.
KNN = KNeighborsClassifier(n_neighbors=3)
Fit the instance on the data and then predict the expected value.
KNN = KNN.fit(X_data, y_data)
y_predict = KNN.predict(X_data)
K Nearest Neighbors: The Syntax
40
Learning Objectives Recap
• Name the steps in the data science workflow
• Explain how to formulate a supervised learning problem
• Compare “Training” and “Inference”
• Describe the dangers of overfitting, and training vs. testing data
• Identify the advantages of the PyData* ecosystem
In this lesson, we worked to:
*Other names and brands may be claimed as the property of others.
Supervised learning

More Related Content

What's hot

Unsupervised Learning - Teaching AI to Understand Our World
Unsupervised Learning - Teaching AI to Understand Our WorldUnsupervised Learning - Teaching AI to Understand Our World
Unsupervised Learning - Teaching AI to Understand Our World
Sakha Global
 
Principal Component Analysis
Principal Component AnalysisPrincipal Component Analysis
Principal Component Analysis
Ricardo Wendell Rodrigues da Silveira
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
ankur bhalla
 
Machine Learning Overview.pptx
Machine Learning Overview.pptxMachine Learning Overview.pptx
Machine Learning Overview.pptx
RushikeshChikane2
 
Classification Algorithm.
Classification Algorithm.Classification Algorithm.
Classification Algorithm.
Megha Sharma
 
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Simplilearn
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning Algorithms
Hichem Felouat
 
Random Forest In R | Random Forest Algorithm | Random Forest Tutorial |Machin...
Random Forest In R | Random Forest Algorithm | Random Forest Tutorial |Machin...Random Forest In R | Random Forest Algorithm | Random Forest Tutorial |Machin...
Random Forest In R | Random Forest Algorithm | Random Forest Tutorial |Machin...
Simplilearn
 
Autoencoders
AutoencodersAutoencoders
Autoencoders
CloudxLab
 
Data preprocessing using Machine Learning
Data  preprocessing using Machine Learning Data  preprocessing using Machine Learning
Data preprocessing using Machine Learning
Gopal Sakarkar
 
Introduction to Machine Learning Classifiers
Introduction to Machine Learning ClassifiersIntroduction to Machine Learning Classifiers
Introduction to Machine Learning Classifiers
Functional Imperative
 
Wrapper feature selection method
Wrapper feature selection methodWrapper feature selection method
Wrapper feature selection method
Amir Razmjou
 
Introduction to XGBoost
Introduction to XGBoostIntroduction to XGBoost
Introduction to XGBoost
Joonyoung Yi
 
Association rule mining.pptx
Association rule mining.pptxAssociation rule mining.pptx
Association rule mining.pptx
maha797959
 
Anomaly detection with machine learning at scale
Anomaly detection with machine learning at scaleAnomaly detection with machine learning at scale
Anomaly detection with machine learning at scale
Impetus Technologies
 
The 7 steps of Machine Learning
The 7 steps of Machine LearningThe 7 steps of Machine Learning
The 7 steps of Machine Learning
Waziri Shebogholo
 
Introduction to Deep Learning, Keras, and TensorFlow
Introduction to Deep Learning, Keras, and TensorFlowIntroduction to Deep Learning, Keras, and TensorFlow
Introduction to Deep Learning, Keras, and TensorFlow
Sri Ambati
 
supervised learning
supervised learningsupervised learning
supervised learning
Amar Tripathi
 
Introduction to Linear Discriminant Analysis
Introduction to Linear Discriminant AnalysisIntroduction to Linear Discriminant Analysis
Introduction to Linear Discriminant Analysis
Jaclyn Kokx
 
Hyperparameter Optimization for Machine Learning
Hyperparameter Optimization for Machine LearningHyperparameter Optimization for Machine Learning
Hyperparameter Optimization for Machine Learning
Francesco Casalegno
 

What's hot (20)

Unsupervised Learning - Teaching AI to Understand Our World
Unsupervised Learning - Teaching AI to Understand Our WorldUnsupervised Learning - Teaching AI to Understand Our World
Unsupervised Learning - Teaching AI to Understand Our World
 
Principal Component Analysis
Principal Component AnalysisPrincipal Component Analysis
Principal Component Analysis
 
Data preprocessing
Data preprocessingData preprocessing
Data preprocessing
 
Machine Learning Overview.pptx
Machine Learning Overview.pptxMachine Learning Overview.pptx
Machine Learning Overview.pptx
 
Classification Algorithm.
Classification Algorithm.Classification Algorithm.
Classification Algorithm.
 
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
Support Vector Machine - How Support Vector Machine works | SVM in Machine Le...
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning Algorithms
 
Random Forest In R | Random Forest Algorithm | Random Forest Tutorial |Machin...
Random Forest In R | Random Forest Algorithm | Random Forest Tutorial |Machin...Random Forest In R | Random Forest Algorithm | Random Forest Tutorial |Machin...
Random Forest In R | Random Forest Algorithm | Random Forest Tutorial |Machin...
 
Autoencoders
AutoencodersAutoencoders
Autoencoders
 
Data preprocessing using Machine Learning
Data  preprocessing using Machine Learning Data  preprocessing using Machine Learning
Data preprocessing using Machine Learning
 
Introduction to Machine Learning Classifiers
Introduction to Machine Learning ClassifiersIntroduction to Machine Learning Classifiers
Introduction to Machine Learning Classifiers
 
Wrapper feature selection method
Wrapper feature selection methodWrapper feature selection method
Wrapper feature selection method
 
Introduction to XGBoost
Introduction to XGBoostIntroduction to XGBoost
Introduction to XGBoost
 
Association rule mining.pptx
Association rule mining.pptxAssociation rule mining.pptx
Association rule mining.pptx
 
Anomaly detection with machine learning at scale
Anomaly detection with machine learning at scaleAnomaly detection with machine learning at scale
Anomaly detection with machine learning at scale
 
The 7 steps of Machine Learning
The 7 steps of Machine LearningThe 7 steps of Machine Learning
The 7 steps of Machine Learning
 
Introduction to Deep Learning, Keras, and TensorFlow
Introduction to Deep Learning, Keras, and TensorFlowIntroduction to Deep Learning, Keras, and TensorFlow
Introduction to Deep Learning, Keras, and TensorFlow
 
supervised learning
supervised learningsupervised learning
supervised learning
 
Introduction to Linear Discriminant Analysis
Introduction to Linear Discriminant AnalysisIntroduction to Linear Discriminant Analysis
Introduction to Linear Discriminant Analysis
 
Hyperparameter Optimization for Machine Learning
Hyperparameter Optimization for Machine LearningHyperparameter Optimization for Machine Learning
Hyperparameter Optimization for Machine Learning
 

Similar to Supervised learning

Lesson 3 ai in the enterprise
Lesson 3   ai in the enterpriseLesson 3   ai in the enterprise
Lesson 3 ai in the enterprise
ankit_ppt
 
Doing Analytics Right - Building the Analytics Environment
Doing Analytics Right - Building the Analytics EnvironmentDoing Analytics Right - Building the Analytics Environment
Doing Analytics Right - Building the Analytics Environment
Tasktop
 
Managing Data Science Projects
Managing Data Science ProjectsManaging Data Science Projects
Managing Data Science Projects
Danielle Dean
 
Afternoons with Azure - Azure Machine Learning
Afternoons with Azure - Azure Machine Learning Afternoons with Azure - Azure Machine Learning
Afternoons with Azure - Azure Machine Learning
CCG
 
Anwar kamal .pdf.pptx
Anwar kamal .pdf.pptxAnwar kamal .pdf.pptx
Anwar kamal .pdf.pptx
Luminous8
 
Data Science.pdf
Data Science.pdfData Science.pdf
Data Science.pdf
WinduGata3
 
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
Alok Singh
 
Andrew NG machine learning
Andrew NG machine learningAndrew NG machine learning
Andrew NG machine learning
ShareDocView.com
 
Managing machine learning
Managing machine learningManaging machine learning
Managing machine learning
David Murgatroyd
 
FlorenceAI: Reinventing Data Science at Humana
FlorenceAI: Reinventing Data Science at HumanaFlorenceAI: Reinventing Data Science at Humana
FlorenceAI: Reinventing Data Science at Humana
Databricks
 
ML_Module_1.pdf
ML_Module_1.pdfML_Module_1.pdf
ML_Module_1.pdf
JafarHussain48
 
AI-900 - Fundamental Principles of ML.pptx
AI-900 - Fundamental Principles of ML.pptxAI-900 - Fundamental Principles of ML.pptx
AI-900 - Fundamental Principles of ML.pptx
kprasad8
 
artificggggggggggggggialintelligence.pdf
artificggggggggggggggialintelligence.pdfartificggggggggggggggialintelligence.pdf
artificggggggggggggggialintelligence.pdf
tt4765690
 
AI hype or reality
AI  hype or realityAI  hype or reality
AI hype or reality
Awantik Das
 
Barga Data Science lecture 10
Barga Data Science lecture 10Barga Data Science lecture 10
Barga Data Science lecture 10
Roger Barga
 
Introduction to ML (Machine Learning)
Introduction to ML (Machine Learning)Introduction to ML (Machine Learning)
Introduction to ML (Machine Learning)
SwatiTripathi44
 
Architecting for Data Science
Architecting for Data ScienceArchitecting for Data Science
Architecting for Data Science
Johann Schleier-Smith
 
L1 Introduction DS.pptx
L1 Introduction DS.pptxL1 Introduction DS.pptx
L1 Introduction DS.pptx
Shambhavi Vats
 
How to Build an AI/ML Product and Sell it by SalesChoice CPO
How to Build an AI/ML Product and Sell it by SalesChoice CPOHow to Build an AI/ML Product and Sell it by SalesChoice CPO
How to Build an AI/ML Product and Sell it by SalesChoice CPO
Product School
 
Self Study Business Approach to DS_01022022.docx
Self Study Business Approach to DS_01022022.docxSelf Study Business Approach to DS_01022022.docx
Self Study Business Approach to DS_01022022.docx
Shanmugasundaram M
 

Similar to Supervised learning (20)

Lesson 3 ai in the enterprise
Lesson 3   ai in the enterpriseLesson 3   ai in the enterprise
Lesson 3 ai in the enterprise
 
Doing Analytics Right - Building the Analytics Environment
Doing Analytics Right - Building the Analytics EnvironmentDoing Analytics Right - Building the Analytics Environment
Doing Analytics Right - Building the Analytics Environment
 
Managing Data Science Projects
Managing Data Science ProjectsManaging Data Science Projects
Managing Data Science Projects
 
Afternoons with Azure - Azure Machine Learning
Afternoons with Azure - Azure Machine Learning Afternoons with Azure - Azure Machine Learning
Afternoons with Azure - Azure Machine Learning
 
Anwar kamal .pdf.pptx
Anwar kamal .pdf.pptxAnwar kamal .pdf.pptx
Anwar kamal .pdf.pptx
 
Data Science.pdf
Data Science.pdfData Science.pdf
Data Science.pdf
 
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
Big Data Spain 2018: How to build Weighted XGBoost ML model for Imbalance dat...
 
Andrew NG machine learning
Andrew NG machine learningAndrew NG machine learning
Andrew NG machine learning
 
Managing machine learning
Managing machine learningManaging machine learning
Managing machine learning
 
FlorenceAI: Reinventing Data Science at Humana
FlorenceAI: Reinventing Data Science at HumanaFlorenceAI: Reinventing Data Science at Humana
FlorenceAI: Reinventing Data Science at Humana
 
ML_Module_1.pdf
ML_Module_1.pdfML_Module_1.pdf
ML_Module_1.pdf
 
AI-900 - Fundamental Principles of ML.pptx
AI-900 - Fundamental Principles of ML.pptxAI-900 - Fundamental Principles of ML.pptx
AI-900 - Fundamental Principles of ML.pptx
 
artificggggggggggggggialintelligence.pdf
artificggggggggggggggialintelligence.pdfartificggggggggggggggialintelligence.pdf
artificggggggggggggggialintelligence.pdf
 
AI hype or reality
AI  hype or realityAI  hype or reality
AI hype or reality
 
Barga Data Science lecture 10
Barga Data Science lecture 10Barga Data Science lecture 10
Barga Data Science lecture 10
 
Introduction to ML (Machine Learning)
Introduction to ML (Machine Learning)Introduction to ML (Machine Learning)
Introduction to ML (Machine Learning)
 
Architecting for Data Science
Architecting for Data ScienceArchitecting for Data Science
Architecting for Data Science
 
L1 Introduction DS.pptx
L1 Introduction DS.pptxL1 Introduction DS.pptx
L1 Introduction DS.pptx
 
How to Build an AI/ML Product and Sell it by SalesChoice CPO
How to Build an AI/ML Product and Sell it by SalesChoice CPOHow to Build an AI/ML Product and Sell it by SalesChoice CPO
How to Build an AI/ML Product and Sell it by SalesChoice CPO
 
Self Study Business Approach to DS_01022022.docx
Self Study Business Approach to DS_01022022.docxSelf Study Business Approach to DS_01022022.docx
Self Study Business Approach to DS_01022022.docx
 

More from ankit_ppt

Deep learning summary
Deep learning summaryDeep learning summary
Deep learning summary
ankit_ppt
 
08 neural networks
08 neural networks08 neural networks
08 neural networks
ankit_ppt
 
07 learning
07 learning07 learning
07 learning
ankit_ppt
 
06 image features
06 image features06 image features
06 image features
ankit_ppt
 
05 contours seg_matching
05 contours seg_matching05 contours seg_matching
05 contours seg_matching
ankit_ppt
 
04 image transformations_ii
04 image transformations_ii04 image transformations_ii
04 image transformations_ii
ankit_ppt
 
03 image transformations_i
03 image transformations_i03 image transformations_i
03 image transformations_i
ankit_ppt
 
02 image processing
02 image processing02 image processing
02 image processing
ankit_ppt
 
01 foundations
01 foundations01 foundations
01 foundations
ankit_ppt
 
Word2 vec
Word2 vecWord2 vec
Word2 vec
ankit_ppt
 
Text similarity measures
Text similarity measuresText similarity measures
Text similarity measures
ankit_ppt
 
Text generation and_advanced_topics
Text generation and_advanced_topicsText generation and_advanced_topics
Text generation and_advanced_topics
ankit_ppt
 
Nlp toolkits and_preprocessing_techniques
Nlp toolkits and_preprocessing_techniquesNlp toolkits and_preprocessing_techniques
Nlp toolkits and_preprocessing_techniques
ankit_ppt
 
Matrix decomposition and_applications_to_nlp
Matrix decomposition and_applications_to_nlpMatrix decomposition and_applications_to_nlp
Matrix decomposition and_applications_to_nlp
ankit_ppt
 
Machine learning and_nlp
Machine learning and_nlpMachine learning and_nlp
Machine learning and_nlp
ankit_ppt
 
Latent dirichlet allocation_and_topic_modeling
Latent dirichlet allocation_and_topic_modelingLatent dirichlet allocation_and_topic_modeling
Latent dirichlet allocation_and_topic_modeling
ankit_ppt
 
Intro to nlp
Intro to nlpIntro to nlp
Intro to nlp
ankit_ppt
 
Ot regularization and_gradient_descent
Ot regularization and_gradient_descentOt regularization and_gradient_descent
Ot regularization and_gradient_descent
ankit_ppt
 
Ml10 dimensionality reduction-and_advanced_topics
Ml10 dimensionality reduction-and_advanced_topicsMl10 dimensionality reduction-and_advanced_topics
Ml10 dimensionality reduction-and_advanced_topics
ankit_ppt
 
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
ankit_ppt
 

More from ankit_ppt (20)

Deep learning summary
Deep learning summaryDeep learning summary
Deep learning summary
 
08 neural networks
08 neural networks08 neural networks
08 neural networks
 
07 learning
07 learning07 learning
07 learning
 
06 image features
06 image features06 image features
06 image features
 
05 contours seg_matching
05 contours seg_matching05 contours seg_matching
05 contours seg_matching
 
04 image transformations_ii
04 image transformations_ii04 image transformations_ii
04 image transformations_ii
 
03 image transformations_i
03 image transformations_i03 image transformations_i
03 image transformations_i
 
02 image processing
02 image processing02 image processing
02 image processing
 
01 foundations
01 foundations01 foundations
01 foundations
 
Word2 vec
Word2 vecWord2 vec
Word2 vec
 
Text similarity measures
Text similarity measuresText similarity measures
Text similarity measures
 
Text generation and_advanced_topics
Text generation and_advanced_topicsText generation and_advanced_topics
Text generation and_advanced_topics
 
Nlp toolkits and_preprocessing_techniques
Nlp toolkits and_preprocessing_techniquesNlp toolkits and_preprocessing_techniques
Nlp toolkits and_preprocessing_techniques
 
Matrix decomposition and_applications_to_nlp
Matrix decomposition and_applications_to_nlpMatrix decomposition and_applications_to_nlp
Matrix decomposition and_applications_to_nlp
 
Machine learning and_nlp
Machine learning and_nlpMachine learning and_nlp
Machine learning and_nlp
 
Latent dirichlet allocation_and_topic_modeling
Latent dirichlet allocation_and_topic_modelingLatent dirichlet allocation_and_topic_modeling
Latent dirichlet allocation_and_topic_modeling
 
Intro to nlp
Intro to nlpIntro to nlp
Intro to nlp
 
Ot regularization and_gradient_descent
Ot regularization and_gradient_descentOt regularization and_gradient_descent
Ot regularization and_gradient_descent
 
Ml10 dimensionality reduction-and_advanced_topics
Ml10 dimensionality reduction-and_advanced_topicsMl10 dimensionality reduction-and_advanced_topics
Ml10 dimensionality reduction-and_advanced_topics
 
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
 

Recently uploaded

Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
Digital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes completeDigital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes complete
shubhamsaraswat8740
 
EV BMS WITH CHARGE MONITOR AND FIRE DETECTION.pptx
EV BMS WITH CHARGE MONITOR AND FIRE DETECTION.pptxEV BMS WITH CHARGE MONITOR AND FIRE DETECTION.pptx
EV BMS WITH CHARGE MONITOR AND FIRE DETECTION.pptx
nikshimanasa
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
uqyfuc
 
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
felixwold
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
harshapolam10
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
aryanpankaj78
 
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICSUNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
vmspraneeth
 
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdfSELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
Pallavi Sharma
 
Ericsson LTE Throughput Troubleshooting Techniques.ppt
Ericsson LTE Throughput Troubleshooting Techniques.pptEricsson LTE Throughput Troubleshooting Techniques.ppt
Ericsson LTE Throughput Troubleshooting Techniques.ppt
wafawafa52
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
Paris Salesforce Developer Group
 
Beckhoff Programmable Logic Control Overview Presentation
Beckhoff Programmable Logic Control Overview PresentationBeckhoff Programmable Logic Control Overview Presentation
Beckhoff Programmable Logic Control Overview Presentation
VanTuDuong1
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
sydezfe
 
Levelised Cost of Hydrogen (LCOH) Calculator Manual
Levelised Cost of Hydrogen  (LCOH) Calculator ManualLevelised Cost of Hydrogen  (LCOH) Calculator Manual
Levelised Cost of Hydrogen (LCOH) Calculator Manual
Massimo Talia
 
This study Examines the Effectiveness of Talent Procurement through the Imple...
This study Examines the Effectiveness of Talent Procurement through the Imple...This study Examines the Effectiveness of Talent Procurement through the Imple...
This study Examines the Effectiveness of Talent Procurement through the Imple...
DharmaBanothu
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
nedcocy
 
OOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming languageOOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming language
PreethaV16
 
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Transcat
 

Recently uploaded (20)

Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
Digital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes completeDigital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes complete
 
EV BMS WITH CHARGE MONITOR AND FIRE DETECTION.pptx
EV BMS WITH CHARGE MONITOR AND FIRE DETECTION.pptxEV BMS WITH CHARGE MONITOR AND FIRE DETECTION.pptx
EV BMS WITH CHARGE MONITOR AND FIRE DETECTION.pptx
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
 
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICSUNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
 
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdfSELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
 
Ericsson LTE Throughput Troubleshooting Techniques.ppt
Ericsson LTE Throughput Troubleshooting Techniques.pptEricsson LTE Throughput Troubleshooting Techniques.ppt
Ericsson LTE Throughput Troubleshooting Techniques.ppt
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
 
Beckhoff Programmable Logic Control Overview Presentation
Beckhoff Programmable Logic Control Overview PresentationBeckhoff Programmable Logic Control Overview Presentation
Beckhoff Programmable Logic Control Overview Presentation
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
 
Levelised Cost of Hydrogen (LCOH) Calculator Manual
Levelised Cost of Hydrogen  (LCOH) Calculator ManualLevelised Cost of Hydrogen  (LCOH) Calculator Manual
Levelised Cost of Hydrogen (LCOH) Calculator Manual
 
This study Examines the Effectiveness of Talent Procurement through the Imple...
This study Examines the Effectiveness of Talent Procurement through the Imple...This study Examines the Effectiveness of Talent Procurement through the Imple...
This study Examines the Effectiveness of Talent Procurement through the Imple...
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
 
OOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming languageOOPS_Lab_Manual - programs using C++ programming language
OOPS_Lab_Manual - programs using C++ programming language
 
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
 

Supervised learning

  • 2. 2 Legal Disclaimers No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document. Intel technologies’ features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. Check with your system manufacturer or retailer or learn more at intel.com. Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade. Copies of documents which have an order number and are referenced in this document may be obtained by calling 1-800-548-4725 or by visiting www.intel.com/design/literature.htm. Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and/or other countries. *Other names and brands may be claimed as the property of others Copyright © 2018 Intel Corporation. All rights reserved.
  • 3. 3 Learning Objectives • Name the steps in the data science workflow • Explain how to formulate a supervised learning problem • Compare “Training” and “Inference” • Describe the dangers of overfitting, and training vs. testing data • Identify the advantages of the PyData* ecosystem You will be able to: *Other names and brands may be claimed as the property of others.
  • 4.
  • 5. 5 Machine Learning The study and construction of programs that learn from repeatedly seeing data, rather than being explicitly programmed by humans. Data points have known outcome Supervised Learning Unsupervised Learning Dataset Data points have unknown outcome Type
  • 6. 6 Target vs. Features TargetFeatures Target: Column to predict Features: Properties of the data used for prediction (non-target columns)
  • 7. Example: Supervised Learning Problem NOT SPAM? Supervised Learning Program SPAM? Goal: Predict if an email is spam or not spam. Data: Historical emails labeled as spam or not spam. Target: Spam or not spam Features: Email text, subject, time sent, etc.
  • 8. Example: Supervised Learning Problem Goal: Predict location of bounding box around an object. Data: Images with bounding box locations. Target: Corners of bounding box Features: Image pixels
  • 9.
  • 10. 10 Data Science Workflow Problem Statement Data Collection Data Exploration & Preprocessing Modeling Validation Decision Making & Deployment What problem are you trying to solve? What data do you need to solve it? How should you clean your data so your model can use it? Build a model to solve your problem? Did I solve the problem? Communicate to stakeholders or put into production?
  • 11. 11 This Lesson’s Focus: Modeling and Validation Problem Statement Data Collection Data Exploration & Preprocessing Modeling Validation Decision Making & Deployment What problem are you trying to solve? What data do you need to solve it? How should you clean your data so your model can use it? Build a model to solve your problem? Did I solve the problem? Communicate to stakeholders or put into production?
  • 12.
  • 13. Formulating a Supervised Learning Problem 13 For a Supervised Learning Problem: • Collect a labeled dataset (features and target labels). • Choose the model. • Choose an evaluation metric: “What to use to measure performance.” • Choose an optimization method:1 “How to find the model configuration that gives the best performance.” 1There are standard methods to use for different models and metrics.
  • 14. Decision tree Which Model? 14 There are many models that represent the problem and make decisions in different ways each with their own advantages and disadvantages. A decision tree makes predictions by asking a series of yes/no questions. Nearest neighbor makes predictions by having the most similar examples vote. Nearest neighbors
  • 15. Which Model? 15 Some considerations when choosing are: • Time needed for training • Speed in making predictions • Amount of data needed • Type of data • Problem complexity • Ability to solve a complex problem • Tendency to overcomplicate a simple one
  • 16. Accuracy target Evaluation Metric 16 There are many metrics available1 to measure performance, such as: • Accuracy: how well predictions match true values. • Mean Squared Error: average square distance between prediction and true value. 1The wrong metric can be misleading or not capture the real problem. Mean square error formula
  • 17. Evaluation Metric 17 Email The wrong metric can be misleading or not capture the real problem. For example: consider using accuracy for spam/not spam. • If 99 out of 100 emails are actually spam, then a model that is predicting spam every time will have 99% accuracy. • This may force an important real email into spam, even though it has a high accuracy metric.
  • 18. Training 18 Training Data: The dataset used to train the model. Optimization: Configures the model for best performance.
  • 19. ? Error Training 19 Forward Backward “Bicycle!” “Strawberry?” Human Bicycle Strawberry With these pieces, a model can now be trained to find the best configuration. Labeled Data Model Evaluation Metric
  • 20. Inference 20 Once the model is trained, we can provide new examples for predictions. ?????? “Bicycle!” ModelNew Data Prediction
  • 21. Training vs. Inference 21 Goal: Perform well on unseen data during inference. ?????? “Bicycle!” ? Error “Bicycle!” “Strawberry?” Human Bicycle Strawberry Model weights TrainingInference
  • 22. Supervised Learning Overview 22 Data with answers (features and labels) Model+ Trained Model Fit Data without answers (features only) Trained Model + Predicted Answer Predict Training: Train a model with known data. Inference: Feed unseen data into trained model to make predictions.
  • 23.
  • 24. Curve Fitting: Overfitting vs. Underfitting Example 24 X Y Goal: Fit a curve to the data.
  • 25. X Y Curve Fitting: Underfitting Example 25 The curve can be too simple. • This is called “underfitting” • Poor fit on training data • Poor fit on unseen data Underfitting: Model is missing systematic trends in data.
  • 26. X Y Curve Fitting: Overfitting Example 26 The curve can be too complex. • This is called “overfitting” • Good fit on training data • Poor fit on unseen data Overfitting: Model is too sensitive and fits the “noise” in the training data.
  • 27. Curve Fitting Problem 27 Problem: Unseen data isn’t available during training. • How can performance be estimated? When measuring performance on the training data, there is a tendency to overfit. Underfit Well fit Overfit
  • 28. 28 Solution: Split Data Into Two Sets Training Set Testing Set Training Set: Data used during the training process. Test Set: Data used to measure performance, simulating unseen data1. 1 Not used during the training process. *Other names and brands may be claimed as the property of others.
  • 29. 29 Train-Test Split Model Weights Training Data Testing Data Evaluate trained model on data it hasn’t “seen” before to simulate real-world inference. “Trained Model” Training Inference Prediction
  • 30. *Other names and brands may be claimed as the property of others.
  • 31. 31 Why Python*? • General purpose language. • Simple, readable syntax relative to other languages, such as Java* or C++. • Has a good REPL. • Can facilitate applications written in other languages, C++ and Fortran. • Active community. • Extensive libraries. *Other names and brands may be claimed as the property of others.
  • 32. 32 Python*: Fastest Growing Programming Language1 1Source: Stack Overflow *Other names and brands may be claimed as the property of others.
  • 33. 33 Python*: Highest Ranked Language1 1Source: IEEE Spectrum *Other names and brands may be claimed as the property of others.
  • 34. 34 Python* Libraries for Data Science Fast numerical computing Data analysis and manipulation Machine learning Visualization Deep Learning *Other names and brands may be claimed as the property of others.
  • 35. Intel® Distribution for Python* Easy, Out-of-the-box Access to High Performance Python* • Prebuilt, optimized for numerical computing, data analytics, High Performance Computing (HPC). • Drop in replacement for your existing Python (no code changes required). • Download from https://software.intel.com/en-us/distribution-for-python *Other names and brands may be claimed as the property of others.
  • 36. Intel® Distribution for Python* Drive Performance with Multiple Optimization Techniques • Accelerated NumPy/ SciPy / Scikit-Learn with the Intel® Math Kernel Library (Intel® MKL). • Data analytics with pyDAAL, enhanced thread scheduling with Intel® Thread Building Blocks (Intel® TBB), Jupyter* Notebook interface, Numba, Cython*. • Scale easily with optimized MPI4Py* and Jupyter* notebooks. *Other names and brands may be claimed as the property of others.
  • 37. Intel® Distribution for Python* Faster Access to Latest Optimizations for Intel® Architecture • Distribution and individual optimized packages available through Conda* and Anaconda Cloud*. • Optimizations upstreamed back to main Python* trunk. *Other names and brands may be claimed as the property of others.
  • 38. Train and Test Splitting: Syntax Import the train and test split function. from sklearn.model_selection import train_test_split Split the data and put 30% into the test set. train, test = train_test_split(data, test_size=0.3) Other method for splitting data. from sklearn.model_selection import ShuffleSplit
  • 39. Import the class containing the classification method. from sklearn.neighbors import KNeighborsClassifier Create an instance of the class. KNN = KNeighborsClassifier(n_neighbors=3) Fit the instance on the data and then predict the expected value. KNN = KNN.fit(X_data, y_data) y_predict = KNN.predict(X_data) K Nearest Neighbors: The Syntax
  • 40. 40 Learning Objectives Recap • Name the steps in the data science workflow • Explain how to formulate a supervised learning problem • Compare “Training” and “Inference” • Describe the dangers of overfitting, and training vs. testing data • Identify the advantages of the PyData* ecosystem In this lesson, we worked to: *Other names and brands may be claimed as the property of others.

Editor's Notes

  1. For more details refer to ML 101
  2. A spam email in inbox: annoying A real email in the spam folder: missing something important
  3. software.intel.com/intel-distribution-for-python
  4. software.intel.com/intel-distribution-for-python
  5. software.intel.com/intel-distribution-for-python