SlideShare a Scribd company logo
Ruby Shrestha
THE ABC OF IMPLEMENTING
SUPERVISED ML WITH
PYTHON
| MACHINE LEARNING |
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.
(source: Wiki)
• Task (T): recognizing and classifying handwritten words within images
• Performance measure (P): percent of words correctly classified
• Training experience (E): a database of handwritten words with given
classifications
OFFICIAL DEFINITION OF
MACHINE LEARNING (ML)
• Sample: Any item to classify. Example, picture, doc, row of DB or CSV file, an audio or video
clip
• Training Set: set of data from which predictive relationship is developed by the system
• Testing Set: set of data whose predictions is to be made by the system or result
automatically derived
• Features: Distinct traits to describe each item in a quantitative manner
• Feature Vector: n-dimensional vector of quantitative features
• Label Vector: 1-dimensional vector of label values / classes, which identify each row of
feature vector (in case of supervised learning)
• Feature Extraction: preparation of Feature Vector and Label Vector
TERMINOLOGIES
EXAMPLE
● Given above is the training set.
● Petal width, petal length, sepal width, sepal length are the features from which we can
create feature vector.
● Species name is the label from which we can create label vector.
● Each row is the sample we have.
● A number of samples form training set, used to train machine. Similarly, other group of
similar samples form testing test for the purpose of testing the accuracy.
• Supervised Learning
• Unsupervised Learning
• Reinforcement Learning
TYPES OF MACHINE LEARNING
TYPES OF SUPERVISED ML
Regression Classification
Fig: Linear Regression
Source: http://ci.columbia.edu
Fig: 3- Class Leaf Species Classification
Source: https://astrobites.org
WORKFLOW OF SUPERVISED ML
Source: NLTK
• Download and Install Python (Basically, sudo apt-get install python3)
• Any IDE: Example, PyCharm (https://itsfoss.com/install-pycharm-ubuntu/)
• Important Python libraries to install (using, pip module):
✓ Numpy: n-dimensional array creation and array related functionalities (pip install numpy)
✓ Scipy: scientific operations (linear algebra, integration, signal and img processing) (pip install scipy)
✓ Matplotlib: plotting figures (pip install matplotlib)
✓ Pandas: high level data manipulation (groupby, merge, join, time series data manipulation) (pip install
pandas)
✓ Sklearn: Machine Learning algorithms (pip install scikit-learn)
• Topic Related Dataset
PREREQUISITES
Usual Method
a = 83;
b = -2;
c = a + b;
A Different Contemporary Approach
“MACHINE LEARNING”
MAKE A MACHINE LEARN TO ADD
LDA A Load operand from location A 0010 0001 0000 0100
ADD B Add operand from location B 0001 0001 0000 0101
STA C Store sum in location C 0011 0001 0000 0110
1. Import required libraries using import statement.
• Example: for importing scikit-learn,
• import sklearn
• import sklearn as sk
• from sklearn.linear_model import LinearRegression
ADDING TWO NUMBERS BASED ON ML
2. Load the dataset.
ADDING TWO NUMBERS BASED ON ML
6 x 3 array
3. Create Feature Set and Label Set.
ADDING TWO NUMBERS BASED ON ML
6 x 2 array
1-d array
// Feature Set
// Label Set
Data Summarization and Visualization
using functions of matplotlib or other
suitable module.
Here, not required
X
4. Choose an appropriate Machine Learning algorithm
According to docs.microsoft.com:
It depends on:
• size, quality, and nature of the data.
• what you want to do with the answer.
• how the math of the algorithm was translated
• how much time you have.
• complexity of the problem at hand.
“Even the most experienced data scientists can't tell which algorithm will
perform best before trying them; however, they can certainly give a strong
hypothesis. ”
ADDING TWO NUMBERS BASED ON ML
5. Create an instance of ML Algorithm so chosen.
How does it work?
Given: x1 and x2 as two numbers to sum and y as result. In Linear Regression:
y=a∗x1+b∗x2+c
For a simple addition the coefficient we are looking for are:
a = 1, b = 1 and c = 0
But here we want the AI to figure it out by itself. So, we just feed it with some
examples ( 2+3=5 , 1+5=6)
ADDING TWO NUMBERS BASED ON ML
6. Fit the linear regression model with the training data.
Fit function finds coefficients required to create a trained model.
Output
ADDING TWO NUMBERS BASED ON ML
7. We’re almost done now ☺ Now we just need to test the trained system
to find summations of two test numbers.
Output
ADDING TWO NUMBERS BASED ON ML
8. Finally, if interested we can find accuracy of the system using
mathematical calculation (accuracy= correct / total) or accuracy_score
function of sklearn.metrics module.
Output
ADDING TWO NUMBERS BASED ON ML
1. Import required libraries using import statement.
2. Load the dataset.
3. Create Feature Set and Label Set.
4. Choose an appropriate Machine Learning algorithm.
5. Create an instance of ML Algorithm so chosen.
6. Fit the model with the training data.
7. Test the system for result.
8. Finally, if interested, find accuracy of the system using mathematical calculation
(accuracy= correct / total) or accuracy_score function of sklearn.metrics
module.
THE OVERALL STEPS NOW
Supervised Machine Learning
Classification Problem
IN THE NEXT PRESENTATION SESSION
THANK YOU

More Related Content

What's hot (20)

PDF
OpenML NeurIPS2018
Joaquin Vanschoren
 
PPTX
Intellectual technologies
Polad Saruxanov
 
PDF
Pybcn machine learning for dummies with python
Javier Arias Losada
 
PDF
Introduction to Machine Learning with SciKit-Learn
Benjamin Bengfort
 
PDF
Numerical tour in the Python eco-system: Python, NumPy, scikit-learn
Arnaud Joly
 
PDF
Dr. Erin LeDell, Machine Learning Scientist, H2O.ai at MLconf SEA - 5/20/16
MLconf
 
PDF
Exposé Ontology
Joaquin Vanschoren
 
PPT
Support Vector Machine (Classification) - Step by Step
Manish nath choudhary
 
PDF
Nikhil Garg, Engineering Manager, Quora at MLconf SF 2016
MLconf
 
ODP
Introduction to FreeMat
Ahmad AlMowaffak
 
PDF
AutoML lectures (ACDL 2019)
Joaquin Vanschoren
 
PPTX
Clustering: A Scikit Learn Tutorial
Damian R. Mingle, MBA
 
PDF
Yellowbrick: Steering machine learning with visual transformers
Rebecca Bilbro
 
PDF
Machine Intelligence at Google Scale: TensorFlow
DataWorks Summit/Hadoop Summit
 
PDF
Dm part03 neural-networks-homework
okeee
 
PDF
(Py)testing the Limits of Machine Learning
Rebecca Bilbro
 
PDF
Visualizing the model selection process
Rebecca Bilbro
 
PDF
EuroSciPy 2019: Visual diagnostics at scale
Rebecca Bilbro
 
PPTX
Methods for meta learning in AutoML
Mohamed Maher
 
PDF
Tensorflowv5.0
Sanjib Basak
 
OpenML NeurIPS2018
Joaquin Vanschoren
 
Intellectual technologies
Polad Saruxanov
 
Pybcn machine learning for dummies with python
Javier Arias Losada
 
Introduction to Machine Learning with SciKit-Learn
Benjamin Bengfort
 
Numerical tour in the Python eco-system: Python, NumPy, scikit-learn
Arnaud Joly
 
Dr. Erin LeDell, Machine Learning Scientist, H2O.ai at MLconf SEA - 5/20/16
MLconf
 
Exposé Ontology
Joaquin Vanschoren
 
Support Vector Machine (Classification) - Step by Step
Manish nath choudhary
 
Nikhil Garg, Engineering Manager, Quora at MLconf SF 2016
MLconf
 
Introduction to FreeMat
Ahmad AlMowaffak
 
AutoML lectures (ACDL 2019)
Joaquin Vanschoren
 
Clustering: A Scikit Learn Tutorial
Damian R. Mingle, MBA
 
Yellowbrick: Steering machine learning with visual transformers
Rebecca Bilbro
 
Machine Intelligence at Google Scale: TensorFlow
DataWorks Summit/Hadoop Summit
 
Dm part03 neural-networks-homework
okeee
 
(Py)testing the Limits of Machine Learning
Rebecca Bilbro
 
Visualizing the model selection process
Rebecca Bilbro
 
EuroSciPy 2019: Visual diagnostics at scale
Rebecca Bilbro
 
Methods for meta learning in AutoML
Mohamed Maher
 
Tensorflowv5.0
Sanjib Basak
 

Similar to The ABC of Implementing Supervised Machine Learning with Python.pptx (20)

PPTX
Lec1 intoduction.pptx
Oussama Haj Salem
 
PDF
Lecture 2 - Introduction to Machine Learning, a lecture in subject module Sta...
Maninda Edirisooriya
 
PPTX
Machine Learning Essentials Demystified part1 | Big Data Demystified
Omid Vahdaty
 
PPTX
Introduction to machine learning
Sangath babu
 
PDF
IRJET- Comparison of Classification Algorithms using Machine Learning
IRJET Journal
 
PDF
Introduction to Machine Learning
Big_Data_Ukraine
 
PPTX
ML Lec 1 (1).pptx
MuhammadTalha278665
 
PPTX
machine learning workflow with data input.pptx
jasontseng19
 
PDF
[Eestec] Machine Learning online seminar 1, 12 2016
Grigoris C
 
PDF
Machine learning Introduction
Dong Guo
 
PPTX
Machine Learning Seminar
Edwin Efraín Jiménez Lepe
 
PDF
Europython - Machine Learning for dummies with Python
Javier Arias Losada
 
PDF
Machine Learning and Deep Learning 4 dummies
Dori Waldman
 
PDF
Machine learning4dummies
Michael Winer
 
PDF
newmicrosoftpowerpointpresentation-210512111200.pdf
abhimanyurajjha002
 
PPTX
Introduction to ML (Machine Learning)
SwatiTripathi44
 
PPTX
artificial intelligence.pptx
rithika858339
 
PDF
Overview of machine learning
SolivarLabs
 
PPTX
Machine-Learning-Overview a statistical approach
Ajit Ghodke
 
Lec1 intoduction.pptx
Oussama Haj Salem
 
Lecture 2 - Introduction to Machine Learning, a lecture in subject module Sta...
Maninda Edirisooriya
 
Machine Learning Essentials Demystified part1 | Big Data Demystified
Omid Vahdaty
 
Introduction to machine learning
Sangath babu
 
IRJET- Comparison of Classification Algorithms using Machine Learning
IRJET Journal
 
Introduction to Machine Learning
Big_Data_Ukraine
 
ML Lec 1 (1).pptx
MuhammadTalha278665
 
machine learning workflow with data input.pptx
jasontseng19
 
[Eestec] Machine Learning online seminar 1, 12 2016
Grigoris C
 
Machine learning Introduction
Dong Guo
 
Machine Learning Seminar
Edwin Efraín Jiménez Lepe
 
Europython - Machine Learning for dummies with Python
Javier Arias Losada
 
Machine Learning and Deep Learning 4 dummies
Dori Waldman
 
Machine learning4dummies
Michael Winer
 
newmicrosoftpowerpointpresentation-210512111200.pdf
abhimanyurajjha002
 
Introduction to ML (Machine Learning)
SwatiTripathi44
 
artificial intelligence.pptx
rithika858339
 
Overview of machine learning
SolivarLabs
 
Machine-Learning-Overview a statistical approach
Ajit Ghodke
 
Ad

Recently uploaded (20)

PPTX
Student_Support_Services_Presentation.pptx
Muhammad439928
 
PPTX
A Portfolio as a Job Search Tool July 2025
Bruce Bennett
 
PDF
Crafting Winning CVs Cover Letters and Mastering Job Interviews with Roman Vi...
Excellence Foundation for South Sudan
 
PDF
Convex optimization analysis in todays world scenario.pdf
mahizxy
 
PDF
hr generalist certification.pdf.........
a25075044
 
PPTX
STATE OFFICERS for organization reference
conqueror3rd
 
PPTX
Ganesh Mahajan Digital marketing Portfolio.pptx
ganeshmahajan786
 
PDF
165. Reviewer Certificate in Physical Science
Manu Mitra
 
PDF
Web Developer Jobs in Jaipur Your Gateway to a Thriving Tech Career in Rajast...
vinay salarite
 
DOCX
PMCF -Performance Monitoring and Coaching Form
ROSALIESOMBILON
 
PPTX
文凭复刻澳洲电子毕业证阳光海岸大学成绩单USC录取通知书
Taqyea
 
PPTX
Using the translanguaging to enhance RES
ssuserb7fdac
 
PPTX
The Future of Law.ppptttttttttttttttttttttttttttttttttttttttttttttttttttttttt...
sahatanmay391
 
PPTX
The Future of Sustainable Cities.ppppptx
sahatanmay391
 
PPTX
Web Developer Jobs in Jaipur Your Gateway to a Thriving Tech Career in Rajast...
vinay salarite
 
PPTX
Leadership Principles Presentations.pptx
ChrisBus1
 
PDF
Smarter Private Job Search Starts with Formwalaa
Reeshna Prajeesh
 
PDF
VisionIAS - UPSC GS Paper I Question Paper 2025 with Answer Key.pdf
saxenashubh937
 
PPTX
CLASSROOM OFFICERS COMPOSITION FOR THE S.Y. 2025-2026
JuffyMastelero
 
PDF
Find Your Dream Job with Formwalaa – Fast, Smart & Effortless Job Search
Reeshna Prajeesh
 
Student_Support_Services_Presentation.pptx
Muhammad439928
 
A Portfolio as a Job Search Tool July 2025
Bruce Bennett
 
Crafting Winning CVs Cover Letters and Mastering Job Interviews with Roman Vi...
Excellence Foundation for South Sudan
 
Convex optimization analysis in todays world scenario.pdf
mahizxy
 
hr generalist certification.pdf.........
a25075044
 
STATE OFFICERS for organization reference
conqueror3rd
 
Ganesh Mahajan Digital marketing Portfolio.pptx
ganeshmahajan786
 
165. Reviewer Certificate in Physical Science
Manu Mitra
 
Web Developer Jobs in Jaipur Your Gateway to a Thriving Tech Career in Rajast...
vinay salarite
 
PMCF -Performance Monitoring and Coaching Form
ROSALIESOMBILON
 
文凭复刻澳洲电子毕业证阳光海岸大学成绩单USC录取通知书
Taqyea
 
Using the translanguaging to enhance RES
ssuserb7fdac
 
The Future of Law.ppptttttttttttttttttttttttttttttttttttttttttttttttttttttttt...
sahatanmay391
 
The Future of Sustainable Cities.ppppptx
sahatanmay391
 
Web Developer Jobs in Jaipur Your Gateway to a Thriving Tech Career in Rajast...
vinay salarite
 
Leadership Principles Presentations.pptx
ChrisBus1
 
Smarter Private Job Search Starts with Formwalaa
Reeshna Prajeesh
 
VisionIAS - UPSC GS Paper I Question Paper 2025 with Answer Key.pdf
saxenashubh937
 
CLASSROOM OFFICERS COMPOSITION FOR THE S.Y. 2025-2026
JuffyMastelero
 
Find Your Dream Job with Formwalaa – Fast, Smart & Effortless Job Search
Reeshna Prajeesh
 
Ad

The ABC of Implementing Supervised Machine Learning with Python.pptx

  • 1. Ruby Shrestha THE ABC OF IMPLEMENTING SUPERVISED ML WITH PYTHON
  • 3. 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. (source: Wiki) • Task (T): recognizing and classifying handwritten words within images • Performance measure (P): percent of words correctly classified • Training experience (E): a database of handwritten words with given classifications OFFICIAL DEFINITION OF MACHINE LEARNING (ML)
  • 4. • Sample: Any item to classify. Example, picture, doc, row of DB or CSV file, an audio or video clip • Training Set: set of data from which predictive relationship is developed by the system • Testing Set: set of data whose predictions is to be made by the system or result automatically derived • Features: Distinct traits to describe each item in a quantitative manner • Feature Vector: n-dimensional vector of quantitative features • Label Vector: 1-dimensional vector of label values / classes, which identify each row of feature vector (in case of supervised learning) • Feature Extraction: preparation of Feature Vector and Label Vector TERMINOLOGIES
  • 5. EXAMPLE ● Given above is the training set. ● Petal width, petal length, sepal width, sepal length are the features from which we can create feature vector. ● Species name is the label from which we can create label vector. ● Each row is the sample we have. ● A number of samples form training set, used to train machine. Similarly, other group of similar samples form testing test for the purpose of testing the accuracy.
  • 6. • Supervised Learning • Unsupervised Learning • Reinforcement Learning TYPES OF MACHINE LEARNING
  • 7. TYPES OF SUPERVISED ML Regression Classification Fig: Linear Regression Source: http://ci.columbia.edu Fig: 3- Class Leaf Species Classification Source: https://astrobites.org
  • 8. WORKFLOW OF SUPERVISED ML Source: NLTK
  • 9. • Download and Install Python (Basically, sudo apt-get install python3) • Any IDE: Example, PyCharm (https://itsfoss.com/install-pycharm-ubuntu/) • Important Python libraries to install (using, pip module): ✓ Numpy: n-dimensional array creation and array related functionalities (pip install numpy) ✓ Scipy: scientific operations (linear algebra, integration, signal and img processing) (pip install scipy) ✓ Matplotlib: plotting figures (pip install matplotlib) ✓ Pandas: high level data manipulation (groupby, merge, join, time series data manipulation) (pip install pandas) ✓ Sklearn: Machine Learning algorithms (pip install scikit-learn) • Topic Related Dataset PREREQUISITES
  • 10. Usual Method a = 83; b = -2; c = a + b; A Different Contemporary Approach “MACHINE LEARNING” MAKE A MACHINE LEARN TO ADD LDA A Load operand from location A 0010 0001 0000 0100 ADD B Add operand from location B 0001 0001 0000 0101 STA C Store sum in location C 0011 0001 0000 0110
  • 11. 1. Import required libraries using import statement. • Example: for importing scikit-learn, • import sklearn • import sklearn as sk • from sklearn.linear_model import LinearRegression ADDING TWO NUMBERS BASED ON ML
  • 12. 2. Load the dataset. ADDING TWO NUMBERS BASED ON ML 6 x 3 array
  • 13. 3. Create Feature Set and Label Set. ADDING TWO NUMBERS BASED ON ML 6 x 2 array 1-d array // Feature Set // Label Set Data Summarization and Visualization using functions of matplotlib or other suitable module. Here, not required X
  • 14. 4. Choose an appropriate Machine Learning algorithm According to docs.microsoft.com: It depends on: • size, quality, and nature of the data. • what you want to do with the answer. • how the math of the algorithm was translated • how much time you have. • complexity of the problem at hand. “Even the most experienced data scientists can't tell which algorithm will perform best before trying them; however, they can certainly give a strong hypothesis. ” ADDING TWO NUMBERS BASED ON ML
  • 15. 5. Create an instance of ML Algorithm so chosen. How does it work? Given: x1 and x2 as two numbers to sum and y as result. In Linear Regression: y=a∗x1+b∗x2+c For a simple addition the coefficient we are looking for are: a = 1, b = 1 and c = 0 But here we want the AI to figure it out by itself. So, we just feed it with some examples ( 2+3=5 , 1+5=6) ADDING TWO NUMBERS BASED ON ML
  • 16. 6. Fit the linear regression model with the training data. Fit function finds coefficients required to create a trained model. Output ADDING TWO NUMBERS BASED ON ML
  • 17. 7. We’re almost done now ☺ Now we just need to test the trained system to find summations of two test numbers. Output ADDING TWO NUMBERS BASED ON ML
  • 18. 8. Finally, if interested we can find accuracy of the system using mathematical calculation (accuracy= correct / total) or accuracy_score function of sklearn.metrics module. Output ADDING TWO NUMBERS BASED ON ML
  • 19. 1. Import required libraries using import statement. 2. Load the dataset. 3. Create Feature Set and Label Set. 4. Choose an appropriate Machine Learning algorithm. 5. Create an instance of ML Algorithm so chosen. 6. Fit the model with the training data. 7. Test the system for result. 8. Finally, if interested, find accuracy of the system using mathematical calculation (accuracy= correct / total) or accuracy_score function of sklearn.metrics module. THE OVERALL STEPS NOW
  • 20. Supervised Machine Learning Classification Problem IN THE NEXT PRESENTATION SESSION