SlideShare une entreprise Scribd logo
1  sur  58
Télécharger pour lire hors ligne
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!

Contenu connexe

Similaire à Practical ai class 2

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
 
Linear Classification
Linear ClassificationLinear Classification
Linear Classification
mailund
 
Lecture8 multi class_svm
Lecture8 multi class_svmLecture8 multi class_svm
Lecture8 multi class_svm
Stéphane Canu
 

Similaire à 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
 

Dernier

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Dernier (20)

INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Practical ai class 2