SlideShare a Scribd company logo
Introduction to
Artificial Intelligence & Deep Learning
Lecture 2: Logistic Regression
Dr. Kobkrit Viriyayudhakorn
Following slides are based on
• Andrew Ng’s Coursera Deep Learning course.
• Stanford CS231n: Convolutional Neural Networks for Visual
Recognition course.
• Goodwill’s Deep Learning Books
• Prof. Thanaruk’s Introduction to Concepts and Techniques in Data
Mining and Application to Text Mining Book.
• Andreas’s Introduction to Machine Learning with Python Book.
• Giancarlo Zaccone’s Getting Start with Tensorflow Book.
• Justine Johnson’s Python Numpy Tutorial
• ETC…
What is Neural Network (Regression)?
Price
Size of House
What is Neural Network (Classification)?Red-dish
Round-dish
House Price Prediction with 4-3-1 NN
Size (x1)
#Bed Room (x2)
Wealth (x4)
Zip Code (x3)
Price
Supervised Learning in Neural Network
Input (X) Output (Y) Application
House Features Price Real Estate Agent
Patient conditions Disease Physician Assistant
Image 10,000 Objects Photo Recognition
CCTV Camera Footage Person Name / Car License
Number
Security / Robot
Audio Text Transcript Speech Recognition, Subtitle
Generation
Text of Thai Language Text of English Language Machine Translation
Radar Signal, Images Position of Obstacle Autonomous Driving
Neural Network Example
Feed Forward Neural Network Convolutional Neural Network (CNN)
Recurrent Neural Network (RNN)
Supervised Learning
• Structure Data • Unstructured Data
Sepal
Length
Sepal
Width
… Species
5.1 3.5 I. setosa
6.3 3.3 I. virginica
Iris Flower Dataset
Why Deep Learning is so popular?
Labelled data (m)
Performance
• Data
• Computation
• Algorithm
Why Deep Learning is taking off?
Logistic Regression
Binary Classification
1 (Flower) or 0 (Non-Flower)
65 10 14 78
43 21 4 25
5 20 130 60
90 120 90 35
78 28 120 30
35 25 1 18
33 12 24 250
65 0 120 45
85 123 4 50
78 88 123 33
Binary Classification
1 (Flower) or 0 (Non-Flower)
255 245 91 128
123 1 244 255
55 80 120 45
85 123 44 39
88 88 123 33
Red
Blue
Green
64
64
Notations
Logistic Regression
Logistic Regression Cost Function
Loss (error) function:
𝑦 = 𝜎 𝑤 𝑇 𝑥 + 𝑏 𝜎 𝑧 =
1
1 + ⅇ−𝑧
𝑥 ⅈ
, 𝑦 ⅈ
… , 𝑥1
𝑚
𝑦 𝑚 𝑦 ⅈ
≈ 𝑦 ⅈ
, where
Given want
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
Gradient Descent
Want to find W, b that minimize 𝐽 W, 𝑏
𝑦 = 𝜎 𝑊 𝑇 𝑥 + 𝑏 𝜎 𝑧 =
1
1 + ⅇ−𝑧, where
𝐽 W, 𝑏 =
1
𝑚
𝑖=1
𝑚
ℒ 𝑦 𝑖
, 𝑦 𝑖 =−
1
𝑚 𝑖=1
𝑚
𝑦 𝑖 log 𝑦+
𝑖
1 − 𝑦 𝑖 log 1 − 𝑦 𝑖
𝐽 W, 𝑏
𝑊
𝑏
Gradient Descent (1D)
w
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
Computation Graph
Computing derivatives
b = 3
a = 5
c = 2
u = bc
v = a + u J = 3v
11
6
33
Computing derivatives
b = 3
a = 5
c = 2
u = bc
v = a + u J = 3v
11
6
33
Logistic Regression Gradient Descent
𝑧 = 𝑤 𝑇
𝑥 + 𝑏
𝑦 = 𝑎 = 𝜎 𝑧
ℒ 𝑎, 𝑦 = − 𝑦 log 𝑎 + 1 − 𝑦 log 𝑎
[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)
Logistic Regression Gradient Descent
𝑧 = 𝑤1 𝑥1 + 𝑤2 𝑥2 + 𝑏
𝑤1
𝑥1
𝑤2
𝑥2
𝑏
𝑎 = 𝜎 𝑧 ℒ 𝑎, 𝑦
Gradient Descent in 𝑚 examples
What is Vectorization?
Algorithm for Logistic Regression

More Related Content

What's hot (20)

PPTX
Fuzzy c means manual work
Dr.E.N.Sathishkumar
 
PDF
Rough K Means - Numerical Example
Dr.E.N.Sathishkumar
 
PPT
Fuzzy c means clustering protocol for wireless sensor networks
mourya chandra
 
PPTX
Image-Based E-Commerce Product Discovery: A Deep Learning Case Study - Denis ...
Lucidworks
 
PDF
Blur Filter - Hanpo
Hanpo Cheng
 
PPTX
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
JinTaek Seo
 
PPTX
Gaussian Image Blurring in CUDA C++
Darshan Parsana
 
PPTX
Conference on theoretical and applied computer science
Sandeep Katta
 
PPS
A Tutorial On Ip 1
ankuredkie
 
PPTX
Non Deterministic and Deterministic Problems
Scandala Tamang
 
PPT
07object3d
Ketan Jani
 
PDF
Normalization cross correlation value of
eSAT Publishing House
 
PPTX
Digital Differential Analyzer Line Drawing Algorithm
Kasun Ranga Wijeweera
 
PPTX
Dda algorithm
Mani Kanth
 
PDF
Bresenham Line Drawing Algorithm
Kasun Ranga Wijeweera
 
PDF
Circular Convolution
Sarang Joshi
 
PDF
Binary Number System and Codes
Digital System Design
 
DOCX
Dda algo notes
shreeja asopa
 
PDF
All pairs shortest path algorithm
Srikrishnan Suresh
 
PPTX
Computer graphics presentation
LOKENDRA PRAJAPATI
 
Fuzzy c means manual work
Dr.E.N.Sathishkumar
 
Rough K Means - Numerical Example
Dr.E.N.Sathishkumar
 
Fuzzy c means clustering protocol for wireless sensor networks
mourya chandra
 
Image-Based E-Commerce Product Discovery: A Deep Learning Case Study - Denis ...
Lucidworks
 
Blur Filter - Hanpo
Hanpo Cheng
 
Beginning direct3d gameprogramming01_thehistoryofdirect3dgraphics_20160407_ji...
JinTaek Seo
 
Gaussian Image Blurring in CUDA C++
Darshan Parsana
 
Conference on theoretical and applied computer science
Sandeep Katta
 
A Tutorial On Ip 1
ankuredkie
 
Non Deterministic and Deterministic Problems
Scandala Tamang
 
07object3d
Ketan Jani
 
Normalization cross correlation value of
eSAT Publishing House
 
Digital Differential Analyzer Line Drawing Algorithm
Kasun Ranga Wijeweera
 
Dda algorithm
Mani Kanth
 
Bresenham Line Drawing Algorithm
Kasun Ranga Wijeweera
 
Circular Convolution
Sarang Joshi
 
Binary Number System and Codes
Digital System Design
 
Dda algo notes
shreeja asopa
 
All pairs shortest path algorithm
Srikrishnan Suresh
 
Computer graphics presentation
LOKENDRA PRAJAPATI
 

Similar to [Lecture 2] AI and Deep Learning: Logistic Regression (Theory) (20)

PPTX
Difference between logistic regression shallow neural network and deep neura...
Chode Amarnath
 
PPTX
Logistic-regression-Supervised-MachineLearning.pptx
AsmaChikhaoui2
 
PPTX
5_LR_Apr_7_2021.pptx in nature language processing
attaurahman
 
PDF
Practical AI class 1
Oliver Zhang
 
PDF
3ml.pdf
MianAdnan27
 
PDF
7_logistic-regression presentation sur la regression logistique.pdf
doumadongmo
 
PDF
Linear logisticregression
kongara
 
PDF
Week_2_Neural_Networks_Basichhhhhhhs.pdf
Aliker5
 
PDF
6 logistic regression classification algo
TanmayVijay1
 
PDF
working with python
bhavesh lande
 
PPTX
Artificial Neural Network
Dessy Amirudin
 
PDF
Machine Learning with Python- Machine Learning Algorithms- Logistic Regressio...
KalighatOkira
 
PPTX
Logistic Regression power point presentation.pptx
harshasawa2003
 
PPTX
Logistic Regression | Logistic Regression In Python | Machine Learning Algori...
Simplilearn
 
PPTX
lec+5+_part+1 cloud .pptx
samaghorab
 
PDF
Lecture 6 - Logistic Regression, a lecture in subject module Statistical & Ma...
Maninda Edirisooriya
 
PDF
Introduction to Artificial Neural Networks
Stratio
 
PPTX
2. Linear regression with one variable.pptx
Emad Nabil
 
PDF
Day 2 build up your own neural network
HuyPhmNht2
 
PPTX
Supervised Machine Learning Algorithms
engrfarhanhanif
 
Difference between logistic regression shallow neural network and deep neura...
Chode Amarnath
 
Logistic-regression-Supervised-MachineLearning.pptx
AsmaChikhaoui2
 
5_LR_Apr_7_2021.pptx in nature language processing
attaurahman
 
Practical AI class 1
Oliver Zhang
 
3ml.pdf
MianAdnan27
 
7_logistic-regression presentation sur la regression logistique.pdf
doumadongmo
 
Linear logisticregression
kongara
 
Week_2_Neural_Networks_Basichhhhhhhs.pdf
Aliker5
 
6 logistic regression classification algo
TanmayVijay1
 
working with python
bhavesh lande
 
Artificial Neural Network
Dessy Amirudin
 
Machine Learning with Python- Machine Learning Algorithms- Logistic Regressio...
KalighatOkira
 
Logistic Regression power point presentation.pptx
harshasawa2003
 
Logistic Regression | Logistic Regression In Python | Machine Learning Algori...
Simplilearn
 
lec+5+_part+1 cloud .pptx
samaghorab
 
Lecture 6 - Logistic Regression, a lecture in subject module Statistical & Ma...
Maninda Edirisooriya
 
Introduction to Artificial Neural Networks
Stratio
 
2. Linear regression with one variable.pptx
Emad Nabil
 
Day 2 build up your own neural network
HuyPhmNht2
 
Supervised Machine Learning Algorithms
engrfarhanhanif
 
Ad

More from Kobkrit Viriyayudhakorn (20)

PDF
Thai E-Voting System
Kobkrit Viriyayudhakorn
 
PPTX
Thai National ID Card OCR
Kobkrit Viriyayudhakorn
 
PPTX
Chochae Robot - Thai voice communication extension pack for Service Robot
Kobkrit Viriyayudhakorn
 
PDF
ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...
Kobkrit Viriyayudhakorn
 
PDF
Thai Text processing by Transfer Learning using Transformer (Bert)
Kobkrit Viriyayudhakorn
 
PDF
How Emoticon Affects Chatbot Users
Kobkrit Viriyayudhakorn
 
PPTX
หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)
Kobkrit Viriyayudhakorn
 
PDF
Check Raka Chatbot Pitching Presentation
Kobkrit Viriyayudhakorn
 
PPTX
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
Kobkrit Viriyayudhakorn
 
PPTX
[Lecture 4] AI and Deep Learning: Neural Network (Theory)
Kobkrit Viriyayudhakorn
 
PDF
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.
Kobkrit Viriyayudhakorn
 
PDF
Lecture 12: React-Native Firebase Authentication
Kobkrit Viriyayudhakorn
 
PDF
Unity Google VR Cardboard Deployment on iOS and Android
Kobkrit Viriyayudhakorn
 
PDF
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
Kobkrit Viriyayudhakorn
 
PDF
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
Kobkrit Viriyayudhakorn
 
PDF
Lecture 2: C# Programming for VR application in Unity
Kobkrit Viriyayudhakorn
 
PDF
Lecture 1 Introduction to VR Programming
Kobkrit Viriyayudhakorn
 
PDF
Thai Word Embedding with Tensorflow
Kobkrit Viriyayudhakorn
 
PDF
Lecture 3 - ES6 Script Advanced for React-Native
Kobkrit Viriyayudhakorn
 
PDF
สร้างซอฟต์แวร์อย่างไรให้โดนใจผู้คน (How to make software that people love)
Kobkrit Viriyayudhakorn
 
Thai E-Voting System
Kobkrit Viriyayudhakorn
 
Thai National ID Card OCR
Kobkrit Viriyayudhakorn
 
Chochae Robot - Thai voice communication extension pack for Service Robot
Kobkrit Viriyayudhakorn
 
ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (Thai AI updates in yea...
Kobkrit Viriyayudhakorn
 
Thai Text processing by Transfer Learning using Transformer (Bert)
Kobkrit Viriyayudhakorn
 
How Emoticon Affects Chatbot Users
Kobkrit Viriyayudhakorn
 
หัวใจของปัญญาประดิษฐ์ (Gradient Descent ทำงานอย่างไร)
Kobkrit Viriyayudhakorn
 
Check Raka Chatbot Pitching Presentation
Kobkrit Viriyayudhakorn
 
[Lecture 3] AI and Deep Learning: Logistic Regression (Coding)
Kobkrit Viriyayudhakorn
 
[Lecture 4] AI and Deep Learning: Neural Network (Theory)
Kobkrit Viriyayudhakorn
 
ITS488 Lecture 6: Music and Sound Effect & GVR Try out.
Kobkrit Viriyayudhakorn
 
Lecture 12: React-Native Firebase Authentication
Kobkrit Viriyayudhakorn
 
Unity Google VR Cardboard Deployment on iOS and Android
Kobkrit Viriyayudhakorn
 
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
Kobkrit Viriyayudhakorn
 
Lecture 4: ITS488 Digital Content Creation with Unity - Game and VR Programming
Kobkrit Viriyayudhakorn
 
Lecture 2: C# Programming for VR application in Unity
Kobkrit Viriyayudhakorn
 
Lecture 1 Introduction to VR Programming
Kobkrit Viriyayudhakorn
 
Thai Word Embedding with Tensorflow
Kobkrit Viriyayudhakorn
 
Lecture 3 - ES6 Script Advanced for React-Native
Kobkrit Viriyayudhakorn
 
สร้างซอฟต์แวร์อย่างไรให้โดนใจผู้คน (How to make software that people love)
Kobkrit Viriyayudhakorn
 
Ad

Recently uploaded (20)

PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
PDF
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
PPTX
Difference between write and update in odoo 18
Celine George
 
PDF
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
PPTX
TRANSLATIONAL AND ROTATIONAL MOTION.pptx
KIPAIZAGABAWA1
 
PPTX
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
PDF
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PDF
Introduction presentation of the patentbutler tool
MIPLM
 
PPTX
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
PDF
AI-Powered-Visual-Storytelling-for-Nonprofits.pdf
TechSoup
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PDF
epi editorial commitee meeting presentation
MIPLM
 
PPTX
Introduction to Indian Writing in English
Trushali Dodiya
 
PPTX
infertility, types,causes, impact, and management
Ritu480198
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
Difference between write and update in odoo 18
Celine George
 
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
TRANSLATIONAL AND ROTATIONAL MOTION.pptx
KIPAIZAGABAWA1
 
Nitrogen rule, ring rule, mc lafferty.pptx
nbisen2001
 
Android Programming - Basics of Mobile App, App tools and Android Basics
Kavitha P.V
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
Introduction presentation of the patentbutler tool
MIPLM
 
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
AI-Powered-Visual-Storytelling-for-Nonprofits.pdf
TechSoup
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
epi editorial commitee meeting presentation
MIPLM
 
Introduction to Indian Writing in English
Trushali Dodiya
 
infertility, types,causes, impact, and management
Ritu480198
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 

[Lecture 2] AI and Deep Learning: Logistic Regression (Theory)

  • 1. Introduction to Artificial Intelligence & Deep Learning Lecture 2: Logistic Regression Dr. Kobkrit Viriyayudhakorn
  • 2. Following slides are based on • Andrew Ng’s Coursera Deep Learning course. • Stanford CS231n: Convolutional Neural Networks for Visual Recognition course. • Goodwill’s Deep Learning Books • Prof. Thanaruk’s Introduction to Concepts and Techniques in Data Mining and Application to Text Mining Book. • Andreas’s Introduction to Machine Learning with Python Book. • Giancarlo Zaccone’s Getting Start with Tensorflow Book. • Justine Johnson’s Python Numpy Tutorial • ETC…
  • 3. What is Neural Network (Regression)? Price Size of House
  • 4. What is Neural Network (Classification)?Red-dish Round-dish
  • 5. House Price Prediction with 4-3-1 NN Size (x1) #Bed Room (x2) Wealth (x4) Zip Code (x3) Price
  • 6. Supervised Learning in Neural Network Input (X) Output (Y) Application House Features Price Real Estate Agent Patient conditions Disease Physician Assistant Image 10,000 Objects Photo Recognition CCTV Camera Footage Person Name / Car License Number Security / Robot Audio Text Transcript Speech Recognition, Subtitle Generation Text of Thai Language Text of English Language Machine Translation Radar Signal, Images Position of Obstacle Autonomous Driving
  • 7. Neural Network Example Feed Forward Neural Network Convolutional Neural Network (CNN) Recurrent Neural Network (RNN)
  • 8. Supervised Learning • Structure Data • Unstructured Data Sepal Length Sepal Width … Species 5.1 3.5 I. setosa 6.3 3.3 I. virginica Iris Flower Dataset
  • 9. Why Deep Learning is so popular? Labelled data (m) Performance
  • 10. • Data • Computation • Algorithm Why Deep Learning is taking off?
  • 12. Binary Classification 1 (Flower) or 0 (Non-Flower)
  • 13. 65 10 14 78 43 21 4 25 5 20 130 60 90 120 90 35 78 28 120 30 35 25 1 18 33 12 24 250 65 0 120 45 85 123 4 50 78 88 123 33 Binary Classification 1 (Flower) or 0 (Non-Flower) 255 245 91 128 123 1 244 255 55 80 120 45 85 123 44 39 88 88 123 33 Red Blue Green 64 64
  • 16. Logistic Regression Cost Function Loss (error) function: 𝑦 = 𝜎 𝑤 𝑇 𝑥 + 𝑏 𝜎 𝑧 = 1 1 + ⅇ−𝑧 𝑥 ⅈ , 𝑦 ⅈ … , 𝑥1 𝑚 𝑦 𝑚 𝑦 ⅈ ≈ 𝑦 ⅈ , where Given want
  • 18. Gradient Descent Want to find W, b that minimize 𝐽 W, 𝑏 𝑦 = 𝜎 𝑊 𝑇 𝑥 + 𝑏 𝜎 𝑧 = 1 1 + ⅇ−𝑧, where 𝐽 W, 𝑏 = 1 𝑚 𝑖=1 𝑚 ℒ 𝑦 𝑖 , 𝑦 𝑖 =− 1 𝑚 𝑖=1 𝑚 𝑦 𝑖 log 𝑦+ 𝑖 1 − 𝑦 𝑖 log 1 − 𝑦 𝑖 𝐽 W, 𝑏 𝑊 𝑏
  • 22. Computing derivatives b = 3 a = 5 c = 2 u = bc v = a + u J = 3v 11 6 33
  • 23. Computing derivatives b = 3 a = 5 c = 2 u = bc v = a + u J = 3v 11 6 33
  • 24. Logistic Regression Gradient Descent 𝑧 = 𝑤 𝑇 𝑥 + 𝑏 𝑦 = 𝑎 = 𝜎 𝑧 ℒ 𝑎, 𝑦 = − 𝑦 log 𝑎 + 1 − 𝑦 log 𝑎
  • 26. Logistic Regression Gradient Descent 𝑧 = 𝑤1 𝑥1 + 𝑤2 𝑥2 + 𝑏 𝑤1 𝑥1 𝑤2 𝑥2 𝑏 𝑎 = 𝜎 𝑧 ℒ 𝑎, 𝑦
  • 27. Gradient Descent in 𝑚 examples