SlideShare a Scribd company logo
Introduction to
Classification
Class 2
1
Nandita Naik, Proof School
Oliver Zhang, Proof School
02/24/2018
Lesson Plan:
1. Homework Survey and Announcements
2. Review
a. Loss Function
b. Gradient Descent
c. Classification vs Regression
3. Binary Classification
4. Multi Class Classification
Check in: Fill out the Homework Survey!
Announcements:
- Practical AI Syllabus
Machine Learning Model:
Predicting and Training
5
Grade
Homework
hours per
week
f(grade) = homework
hours
6
Grade
Homework
hours per
week
f(grade) = homework
hours
7
Grade
Homework
hours per
week
f(grade) = homework
hours
8
Grade
Homework
hours per
week
f(grade) = homework
hours
9
Grade
Homework
hours per
week
f(grade) = homework
hours
10
Grade
Homework
hours per
week
f(grade) = homework
hours
Loss: A measure of how bad your function is doing
Which Picture Has More Loss?
Loss is based on your line’s slope and its y-intercept
Grade
Homework
hours per
week
w = 1/3
b = 5
Loss Function
We then build a loss function that takes in w
and b and spits out the loss associated with
the line y = wx + b.
For y = wx + b, loss(w, b).
(y = wx + b)
B -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0
W
2.0
1.5
1.0
0.5
0.0
-0.5
-1.0
-1.5
-2.0
(y = wx + b)
B -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0
W
2.0 4.03 4.53 5.53 7.03 9.03 11.5 14.5 18.0 22.0
1.5 5.80 4.05 2.80 2.05 1.80 2.05 2.80 4.05 5.80
1.0 21.8 17.8 14.3 11.3 8.82 6.83 5.33 4.33 3.83
0.5 52.1 45.8 30.1 34.8 30.1 25.8 22.1 18.8 16.1
0.0 96.6 88.1 80.1 72.6 65.5 59.1 53.1 47.6 42.6
-0.5 155 144 134 124 115 106 98 90 83
-1.0 228 215 202 190 179 168 157 147 138
-1.5 315 300 285 271 257 244 231 219 207
-2.0 417 399 382 366 350 334 319 305 291
(y = wx + b)
16
Loss Function
W
b
Loss
(y = wx + b)
Gradient Descent:
Method of Minimizing Loss
Loss
b
w
(y = wx + b)
Loss
b
w
(y = wx + b)
Gradient Descent
20
(y = wx + b)
Regression vs. Classification?
Example:
Regression:
The Outputs are a spectrum
Example:
Classification:
The Outputs are certain categories
Example:
Binary Classification
Binary Classification
Cat or not?
Logistic regression: want model to predict a
probability of belonging to a class
Probability of being a cat = 0.6
Logistic regression is a regression problem
because it predicts a numerical value (i.e. the
probability between 0 and 1) for an input.
If we “round” the probability to the nearest class
(i.e. 0.97 -> 1, and 0.24 -> 0), then we get binary
classification.
Classifying a tumor as malignant or benign
Tumor Size
example from Andrew Ng’s lecture 6
Probability
it’s Malignant
Let’s have the y-axis be the probability that the
tumor is malignant.
Tumor Size
0
1
Probability
it’s Malignant
What happens if we try linear regression?
Tumor Size
Probability
it’s Malignant
0
1
What happens if we try linear regression?
Tumor Size
0
1
thresholdProbability
it’s Malignant
Tumor Size
0
1
Problem: we may get values < 0 or > 1
Probability
it’s Malignant
Using the sigmoid function, we can squash the
output into the range [0,1].
y = mx + b
0
1
(Predicting Malignancy
Based on Tumor Size)
Malignancy0
Probability
it’s Malignant
Probability
it’s Malignant
0
1
Malignancy0
S(0)?
0
1
Malignancy0
½
S(0)?
Probability
it’s Malignant
0
1
Malignancy0
S(1)?
1
¾
Probability
it’s Malignant
0
1
Malignancy0
S(-1)?
1-1
¼
Probability
it’s Malignant
Using the sigmoid function, we can squash the
output into the range [0,1].
y = mx + b
Probability
it’s Malignant
0
1
Malignancy0
(Predicting Malignancy
Based on Tumor Size)
Tumor Size
Probability
it’s Malignant
0
1
Recap: Linear Regression vs. Logistic Regression
Tumor Size
Probability
it’s Malignant
0
1
Tumor Size
Probability
it’s Malignant
0
1
Recap: Linear Regression vs. Logistic Regression
Tumor Size
Probability
it’s Malignant
0
1
0.5
Recap: Linear Regression vs. Logistic Regression
Tumor Size
Probability
it’s Malignant
0
1
0.5
Logistic Regression Visualization
Age
Income
Circle : Flip Phone User
Plus : Not a Flip Phone User.
Logistic Regression Visualization
Age
Income
Circle : Flip Phone User
Plus : Not a Flip Phone User.
Logistic Regression Visualization
Age
Income
Logistic Regression Visualization
Age
Income
Logistic Regression Visualization
Age
Income
Logistic Regression Visualization
Age
Income
Logistic Regression Visualization
Age
Income
Multi Class Classification
Multi Class Classification
Multi Class Classification Probability it’s a:
- dog = 0.3
- cat = 0.7
- guinea pig = 0.5
Probability it’s a:
- dog = 0.8
- cat = 0.5
- guinea pig = 0.4
We will have two implementation problems for
you.
1. Straightforward Logistic Regression
2. Predicting Titanic Survival on Kaggle
Homework:
- Read Binary and Multi Class Classification Notes
- Watch Logsitic Regression
- Ask Questions to make sure you understand material!

More Related Content

Similar to Practical ai class 2

Logistic regression with SPSS
Logistic regression with SPSSLogistic regression with SPSS
Logistic regression with SPSS
LNIPE
 
Machine Learning - Regression model
Machine Learning - Regression modelMachine Learning - Regression model
Machine Learning - Regression model
RADO7900
 
Data Mining Lecture_10(b).pptx
Data Mining Lecture_10(b).pptxData Mining Lecture_10(b).pptx
Data Mining Lecture_10(b).pptx
Subrata Kumer Paul
 
Support Vector Machine and Implementation using Weka
Support Vector Machine and Implementation using WekaSupport Vector Machine and Implementation using Weka
Support Vector Machine and Implementation using Weka
Macha Pujitha
 
Support Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the theSupport Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the the
sanjaibalajeessn
 
Practical AI class 1
Practical AI class 1Practical AI class 1
Practical AI class 1
Oliver Zhang
 
Generalized linear model
Generalized linear modelGeneralized linear model
Generalized linear model
Rahul Rockers
 
Machine Learning (Classification Models)
Machine Learning (Classification Models)Machine Learning (Classification Models)
Machine Learning (Classification Models)
Makerere Unversity School of Public Health, Victoria University
 
PART3UBH 8500Week 11 Step by Step Application Guide 11.3Effect.docx
PART3UBH 8500Week 11 Step by Step Application Guide 11.3Effect.docxPART3UBH 8500Week 11 Step by Step Application Guide 11.3Effect.docx
PART3UBH 8500Week 11 Step by Step Application Guide 11.3Effect.docx
randyburney60861
 
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92
ohenebabismark508
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
Rishabh Gupta
 
Logistic Regression.ppt
Logistic Regression.pptLogistic Regression.ppt
Logistic Regression.ppt
habtamu biazin
 
The world of loss function
The world of loss functionThe world of loss function
The world of loss function
홍배 김
 
李宏毅课件-Regression.pdf
李宏毅课件-Regression.pdf李宏毅课件-Regression.pdf
李宏毅课件-Regression.pdf
ssusere61d07
 
Linear Classification
Linear ClassificationLinear Classification
Linear Classificationmailund
 
Lecture8 multi class_svm
Lecture8 multi class_svmLecture8 multi class_svm
Lecture8 multi class_svmStéphane Canu
 
super vector machines algorithms using deep
super vector machines algorithms using deepsuper vector machines algorithms using deep
super vector machines algorithms using deep
KNaveenKumarECE
 
Regression vs Neural Net
Regression vs Neural NetRegression vs Neural Net
Regression vs Neural Net
Ratul Alahy
 
Linear Regression with Gradient Descent.pdf
Linear Regression with Gradient Descent.pdfLinear Regression with Gradient Descent.pdf
Linear Regression with Gradient Descent.pdf
HarsimarKaur23
 

Similar to Practical ai class 2 (20)

Logistic regression with SPSS
Logistic regression with SPSSLogistic regression with SPSS
Logistic regression with SPSS
 
Machine Learning - Regression model
Machine Learning - Regression modelMachine Learning - Regression model
Machine Learning - Regression model
 
Data Mining Lecture_10(b).pptx
Data Mining Lecture_10(b).pptxData Mining Lecture_10(b).pptx
Data Mining Lecture_10(b).pptx
 
support vector machine
support vector machinesupport vector machine
support vector machine
 
Support Vector Machine and Implementation using Weka
Support Vector Machine and Implementation using WekaSupport Vector Machine and Implementation using Weka
Support Vector Machine and Implementation using Weka
 
Support Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the theSupport Vector Machines is the the the the the the the the the
Support Vector Machines is the the the the the the the the the
 
Practical AI class 1
Practical AI class 1Practical AI class 1
Practical AI class 1
 
Generalized linear model
Generalized linear modelGeneralized linear model
Generalized linear model
 
Machine Learning (Classification Models)
Machine Learning (Classification Models)Machine Learning (Classification Models)
Machine Learning (Classification Models)
 
PART3UBH 8500Week 11 Step by Step Application Guide 11.3Effect.docx
PART3UBH 8500Week 11 Step by Step Application Guide 11.3Effect.docxPART3UBH 8500Week 11 Step by Step Application Guide 11.3Effect.docx
PART3UBH 8500Week 11 Step by Step Application Guide 11.3Effect.docx
 
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92
Ch 6 Slides.doc/9929292929292919299292@:&:&:&9/92
 
Support vector machine
Support vector machineSupport vector machine
Support vector machine
 
Logistic Regression.ppt
Logistic Regression.pptLogistic Regression.ppt
Logistic Regression.ppt
 
The world of loss function
The world of loss functionThe world of loss function
The world of loss function
 
李宏毅课件-Regression.pdf
李宏毅课件-Regression.pdf李宏毅课件-Regression.pdf
李宏毅课件-Regression.pdf
 
Linear Classification
Linear ClassificationLinear Classification
Linear Classification
 
Lecture8 multi class_svm
Lecture8 multi class_svmLecture8 multi class_svm
Lecture8 multi class_svm
 
super vector machines algorithms using deep
super vector machines algorithms using deepsuper vector machines algorithms using deep
super vector machines algorithms using deep
 
Regression vs Neural Net
Regression vs Neural NetRegression vs Neural Net
Regression vs Neural Net
 
Linear Regression with Gradient Descent.pdf
Linear Regression with Gradient Descent.pdfLinear Regression with Gradient Descent.pdf
Linear Regression with Gradient Descent.pdf
 

Recently uploaded

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 

Recently uploaded (20)

Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 

Practical ai class 2