SlideShare a Scribd company logo
Lesson 12
Machine Learning – Logistic Regression Kush Kulshrestha
Introduction
• One of the most simple algorithm used for 2 class classification problem.
• Logistic Regression can be used for various classification problems such as spam detection. Diabetes prediction, if
a given customer will purchase a particular product or will they churn another competitor, whether the user will
click on a given advertisement link or not.
• Just like Linear Regression uses optimize Least Square function to calculate the coefficients, Logistic Regression
uses Log Likelihood function to find the value of the best fit parameters.
• Logistic Regression is the basic algorithm used to define a Neural Network.
Sigmoid Function Refresher
The logistic function or a Sigmoid function is a function which takes any real value between zero and one. It is
defined as
y = 1 / (1 + e-x)
where y is the scaled value and x is the input value.
The logistic function transforms the original range of [-,] to [0,1] and also has a linear part on the transform.
Probability, Odds and Log odds
Probability of an event = (No of Success / Total no of cases)
Odds = (One outcome / all other outcomes)
Examples: Conversion:
• For rolling a dice and getting 1 –
Probability = (1/6)
Odds = (1/5)
• Rolling a dice and getting an even number –
Probability = (3/6) = 0.5
Odds = (3/3) = 1
• Dice roll less than 5 –
Probability = (4/6) = (2/3)
Odds = (4/2) = 2
What is Logistic Regression
Linear regression is continuous response is modelled as a linear combination of the features.
In Logistic regression, log-odds of a categorical response being "true" (1) is modelled as a linear combination of the
features. This is called the logit function.
The equation can be rearranged into the logistic function:
p =
Conclusion –
• Logistic regression outputs the probabilities of a specific class.
• Those probabilities can be converted into class predictions.
• The logistic function takes on an "s" shape and is bounded by 0 and 1.
Interpreting Logistic Regression Coefficients
Final equation of Logistic regression is:
Interpreting beta:
‘1’ unit increase in ‘x' is associated with a B1 unit increase in the log-odds of event for which p is probability of.
Log odds are:
Hence, positive coefficients increase the log-odds of the response (and thus increase the probability), and negative
coefficients decrease the log-odds of the response (and thus decrease the probability).
Machine Learning Algorithm - Logistic Regression
Machine Learning Algorithm - Logistic Regression
Machine Learning Algorithm - Logistic Regression

More Related Content

What's hot (20)

ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introduction
wahab khan
 
Introduction to Graph Theory
Introduction to Graph Theory
Premsankar Chakkingal
 
Gradient descent method
Gradient descent method
Sanghyuk Chun
 
Machine learning with ADA Boost
Machine learning with ADA Boost
Aman Patel
 
Linear regression
Linear regression
MartinHogg9
 
Understanding random forests
Understanding random forests
Marc Garcia
 
Optimization/Gradient Descent
Optimization/Gradient Descent
kandelin
 
Multi-Objective Optimization using Non-Dominated Sorting Genetic Algorithm wi...
Multi-Objective Optimization using Non-Dominated Sorting Genetic Algorithm wi...
Ahmed Gad
 
03 Machine Learning Linear Algebra
03 Machine Learning Linear Algebra
Andres Mendez-Vazquez
 
backpropagation in neural networks
backpropagation in neural networks
Akash Goel
 
Eucledian algorithm for gcd of integers and polynomials
Eucledian algorithm for gcd of integers and polynomials
SWAMY J S
 
Genetic Algorithm in Artificial Intelligence
Genetic Algorithm in Artificial Intelligence
Sinbad Konick
 
Bayseian decision theory
Bayseian decision theory
sia16
 
Fuzzy Logic ppt
Fuzzy Logic ppt
Ritu Bafna
 
Genetic algorithm
Genetic algorithm
garima931
 
Generative adversarial networks
Generative adversarial networks
Yunjey Choi
 
Machine Learning-Linear regression
Machine Learning-Linear regression
kishanthkumaar
 
Decision tree and random forest
Decision tree and random forest
Lippo Group Digital
 
Logistic regression
Logistic regression
YashwantGahlot1
 
Linear regression with gradient descent
Linear regression with gradient descent
Suraj Parmar
 
ProLog (Artificial Intelligence) Introduction
ProLog (Artificial Intelligence) Introduction
wahab khan
 
Gradient descent method
Gradient descent method
Sanghyuk Chun
 
Machine learning with ADA Boost
Machine learning with ADA Boost
Aman Patel
 
Linear regression
Linear regression
MartinHogg9
 
Understanding random forests
Understanding random forests
Marc Garcia
 
Optimization/Gradient Descent
Optimization/Gradient Descent
kandelin
 
Multi-Objective Optimization using Non-Dominated Sorting Genetic Algorithm wi...
Multi-Objective Optimization using Non-Dominated Sorting Genetic Algorithm wi...
Ahmed Gad
 
backpropagation in neural networks
backpropagation in neural networks
Akash Goel
 
Eucledian algorithm for gcd of integers and polynomials
Eucledian algorithm for gcd of integers and polynomials
SWAMY J S
 
Genetic Algorithm in Artificial Intelligence
Genetic Algorithm in Artificial Intelligence
Sinbad Konick
 
Bayseian decision theory
Bayseian decision theory
sia16
 
Fuzzy Logic ppt
Fuzzy Logic ppt
Ritu Bafna
 
Genetic algorithm
Genetic algorithm
garima931
 
Generative adversarial networks
Generative adversarial networks
Yunjey Choi
 
Machine Learning-Linear regression
Machine Learning-Linear regression
kishanthkumaar
 
Linear regression with gradient descent
Linear regression with gradient descent
Suraj Parmar
 

Similar to Machine Learning Algorithm - Logistic Regression (20)

Logistic Regression in machine learning ppt
Logistic Regression in machine learning ppt
raminder12_kaur
 
Linear Regression and Logistic Regression in ML
Linear Regression and Logistic Regression in ML
Kumud Arora
 
Group 20_Logistic Regression devara.pptx
Group 20_Logistic Regression devara.pptx
sriaditya070304
 
Logistic regression.ppt
Logistic regression.ppt
BalaChowdappa1
 
Logistic Regression.pptx
Logistic Regression.pptx
Muskaan194530
 
Logistic regression, machine learning algorithms
Logistic regression, machine learning algorithms
Learnbay Datascience
 
Machine Learning-Lec5.pdf_explain of logistic regression
Machine Learning-Lec5.pdf_explain of logistic regression
BeshoyArnest
 
Interpretation of coefficients Linear and Logistic regression
Interpretation of coefficients Linear and Logistic regression
Ankit Sharma
 
3ml.pdf
3ml.pdf
MianAdnan27
 
LOGISTIC_REGRESSION for AI and ML Beginners
LOGISTIC_REGRESSION for AI and ML Beginners
DebdattaBhattacharya1
 
Supervised Machine Learning Algorithms
Supervised Machine Learning Algorithms
engrfarhanhanif
 
Logistic regression
Logistic regression
Rupak Roy
 
Logistical Regression.pptx
Logistical Regression.pptx
Ramakrishna Reddy Bijjam
 
lec+5+_part+1 cloud .pptx
lec+5+_part+1 cloud .pptx
samaghorab
 
logistic regression in Data science Presentation
logistic regression in Data science Presentation
ARUN R S
 
Logistic RegressionwithMathematicalExamplesonit.pdf
Logistic RegressionwithMathematicalExamplesonit.pdf
ansarinazish958
 
Logistic regression with SPSS examples
Logistic regression with SPSS examples
Gaurav Kamboj
 
Logistic Regression Classifier - Conceptual Guide
Logistic Regression Classifier - Conceptual Guide
Caglar Subasi
 
lrssssssss7777 s jsjs jssssssjs m.pptx
lrssssssss7777 s jsjs jssssssjs m.pptx
SAnjayKumar3129
 
logisticregression-190726150723.pdf
logisticregression-190726150723.pdf
SuaibDanish
 
Logistic Regression in machine learning ppt
Logistic Regression in machine learning ppt
raminder12_kaur
 
Linear Regression and Logistic Regression in ML
Linear Regression and Logistic Regression in ML
Kumud Arora
 
Group 20_Logistic Regression devara.pptx
Group 20_Logistic Regression devara.pptx
sriaditya070304
 
Logistic regression.ppt
Logistic regression.ppt
BalaChowdappa1
 
Logistic Regression.pptx
Logistic Regression.pptx
Muskaan194530
 
Logistic regression, machine learning algorithms
Logistic regression, machine learning algorithms
Learnbay Datascience
 
Machine Learning-Lec5.pdf_explain of logistic regression
Machine Learning-Lec5.pdf_explain of logistic regression
BeshoyArnest
 
Interpretation of coefficients Linear and Logistic regression
Interpretation of coefficients Linear and Logistic regression
Ankit Sharma
 
LOGISTIC_REGRESSION for AI and ML Beginners
LOGISTIC_REGRESSION for AI and ML Beginners
DebdattaBhattacharya1
 
Supervised Machine Learning Algorithms
Supervised Machine Learning Algorithms
engrfarhanhanif
 
Logistic regression
Logistic regression
Rupak Roy
 
lec+5+_part+1 cloud .pptx
lec+5+_part+1 cloud .pptx
samaghorab
 
logistic regression in Data science Presentation
logistic regression in Data science Presentation
ARUN R S
 
Logistic RegressionwithMathematicalExamplesonit.pdf
Logistic RegressionwithMathematicalExamplesonit.pdf
ansarinazish958
 
Logistic regression with SPSS examples
Logistic regression with SPSS examples
Gaurav Kamboj
 
Logistic Regression Classifier - Conceptual Guide
Logistic Regression Classifier - Conceptual Guide
Caglar Subasi
 
lrssssssss7777 s jsjs jssssssjs m.pptx
lrssssssss7777 s jsjs jssssssjs m.pptx
SAnjayKumar3129
 
logisticregression-190726150723.pdf
logisticregression-190726150723.pdf
SuaibDanish
 
Ad

More from Kush Kulshrestha (17)

Clustering - Machine Learning Techniques
Clustering - Machine Learning Techniques
Kush Kulshrestha
 
Machine Learning Algorithm - KNN
Machine Learning Algorithm - KNN
Kush Kulshrestha
 
Machine Learning Algorithm - Decision Trees
Machine Learning Algorithm - Decision Trees
Kush Kulshrestha
 
Machine Learning Algorithm - Naive Bayes for Classification
Machine Learning Algorithm - Naive Bayes for Classification
Kush Kulshrestha
 
Assumptions of Linear Regression - Machine Learning
Assumptions of Linear Regression - Machine Learning
Kush Kulshrestha
 
Interpreting Regression Results - Machine Learning
Interpreting Regression Results - Machine Learning
Kush Kulshrestha
 
Machine Learning Algorithm - Linear Regression
Machine Learning Algorithm - Linear Regression
Kush Kulshrestha
 
General Concepts of Machine Learning
General Concepts of Machine Learning
Kush Kulshrestha
 
Performance Metrics for Machine Learning Algorithms
Performance Metrics for Machine Learning Algorithms
Kush Kulshrestha
 
Visualization-2
Visualization-2
Kush Kulshrestha
 
Visualization-1
Visualization-1
Kush Kulshrestha
 
Inferential Statistics
Inferential Statistics
Kush Kulshrestha
 
Descriptive Statistics
Descriptive Statistics
Kush Kulshrestha
 
Scaling and Normalization
Scaling and Normalization
Kush Kulshrestha
 
Wireless Charging of Electric Vehicles
Wireless Charging of Electric Vehicles
Kush Kulshrestha
 
Time management
Time management
Kush Kulshrestha
 
Handshakes and their types
Handshakes and their types
Kush Kulshrestha
 
Clustering - Machine Learning Techniques
Clustering - Machine Learning Techniques
Kush Kulshrestha
 
Machine Learning Algorithm - KNN
Machine Learning Algorithm - KNN
Kush Kulshrestha
 
Machine Learning Algorithm - Decision Trees
Machine Learning Algorithm - Decision Trees
Kush Kulshrestha
 
Machine Learning Algorithm - Naive Bayes for Classification
Machine Learning Algorithm - Naive Bayes for Classification
Kush Kulshrestha
 
Assumptions of Linear Regression - Machine Learning
Assumptions of Linear Regression - Machine Learning
Kush Kulshrestha
 
Interpreting Regression Results - Machine Learning
Interpreting Regression Results - Machine Learning
Kush Kulshrestha
 
Machine Learning Algorithm - Linear Regression
Machine Learning Algorithm - Linear Regression
Kush Kulshrestha
 
General Concepts of Machine Learning
General Concepts of Machine Learning
Kush Kulshrestha
 
Performance Metrics for Machine Learning Algorithms
Performance Metrics for Machine Learning Algorithms
Kush Kulshrestha
 
Wireless Charging of Electric Vehicles
Wireless Charging of Electric Vehicles
Kush Kulshrestha
 
Handshakes and their types
Handshakes and their types
Kush Kulshrestha
 
Ad

Recently uploaded (20)

Grote OSM datasets zonder kopzorgen bij Reijers
Grote OSM datasets zonder kopzorgen bij Reijers
jacoba18
 
apidays Singapore 2025 - What exactly are AI Agents by Aki Ranin (Earthshots ...
apidays Singapore 2025 - What exactly are AI Agents by Aki Ranin (Earthshots ...
apidays
 
apidays New York 2025 - Beyond Webhooks: The Future of Scalable API Event Del...
apidays New York 2025 - Beyond Webhooks: The Future of Scalable API Event Del...
apidays
 
FME Beyond Data Processing: Creating a Dartboard Accuracy App
FME Beyond Data Processing: Creating a Dartboard Accuracy App
jacoba18
 
Report_Government Authorities_Index_ENG_FIN.pdf
Report_Government Authorities_Index_ENG_FIN.pdf
OlhaTatokhina1
 
QUALITATIVE EXPLANATORY VARIABLES REGRESSION MODELS
QUALITATIVE EXPLANATORY VARIABLES REGRESSION MODELS
Ameya Patekar
 
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays
 
Managed Cloud services - Opsio Cloud Man
Managed Cloud services - Opsio Cloud Man
Opsio Cloud
 
apidays New York 2025 - The FINOS Common Domain Model for Capital Markets by ...
apidays New York 2025 - The FINOS Common Domain Model for Capital Markets by ...
apidays
 
KLIP2Data voor de herinrichting van R4 West en Oost
KLIP2Data voor de herinrichting van R4 West en Oost
jacoba18
 
最新版美国威斯康星大学拉克罗斯分校毕业证(UW–L毕业证书)原版定制
最新版美国威斯康星大学拉克罗斯分校毕业证(UW–L毕业证书)原版定制
Taqyea
 
METHODS OF DATA COLLECTION (Research methodology)
METHODS OF DATA COLLECTION (Research methodology)
anwesha248
 
MEDIA_LITERACY_INDEX_OF_EDUCATORS_ENG.pdf
MEDIA_LITERACY_INDEX_OF_EDUCATORS_ENG.pdf
OlhaTatokhina1
 
Veilig en vlot fietsen in Oost-Vlaanderen: Fietssnelwegen geoptimaliseerd met...
Veilig en vlot fietsen in Oost-Vlaanderen: Fietssnelwegen geoptimaliseerd met...
jacoba18
 
apidays Singapore 2025 - Enhancing Developer Productivity with UX (Government...
apidays Singapore 2025 - Enhancing Developer Productivity with UX (Government...
apidays
 
Data-Driven-Operational--Excellence.pptx
Data-Driven-Operational--Excellence.pptx
NiwanthaThilanjanaGa
 
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays
 
Pause Travail 22 Hostiou Girard 12 juin 2025.pdf
Pause Travail 22 Hostiou Girard 12 juin 2025.pdf
Institut de l'Elevage - Idele
 
SAP_S4HANA_PPM_IT_Corporate_Services_Presentation.pptx
SAP_S4HANA_PPM_IT_Corporate_Services_Presentation.pptx
vemulavenu484
 
apidays New York 2025 - Breaking Barriers: Lessons Learned from API Integrati...
apidays New York 2025 - Breaking Barriers: Lessons Learned from API Integrati...
apidays
 
Grote OSM datasets zonder kopzorgen bij Reijers
Grote OSM datasets zonder kopzorgen bij Reijers
jacoba18
 
apidays Singapore 2025 - What exactly are AI Agents by Aki Ranin (Earthshots ...
apidays Singapore 2025 - What exactly are AI Agents by Aki Ranin (Earthshots ...
apidays
 
apidays New York 2025 - Beyond Webhooks: The Future of Scalable API Event Del...
apidays New York 2025 - Beyond Webhooks: The Future of Scalable API Event Del...
apidays
 
FME Beyond Data Processing: Creating a Dartboard Accuracy App
FME Beyond Data Processing: Creating a Dartboard Accuracy App
jacoba18
 
Report_Government Authorities_Index_ENG_FIN.pdf
Report_Government Authorities_Index_ENG_FIN.pdf
OlhaTatokhina1
 
QUALITATIVE EXPLANATORY VARIABLES REGRESSION MODELS
QUALITATIVE EXPLANATORY VARIABLES REGRESSION MODELS
Ameya Patekar
 
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays New York 2025 - Life is But a (Data) Stream by Sandon Jacobs (Confluent)
apidays
 
Managed Cloud services - Opsio Cloud Man
Managed Cloud services - Opsio Cloud Man
Opsio Cloud
 
apidays New York 2025 - The FINOS Common Domain Model for Capital Markets by ...
apidays New York 2025 - The FINOS Common Domain Model for Capital Markets by ...
apidays
 
KLIP2Data voor de herinrichting van R4 West en Oost
KLIP2Data voor de herinrichting van R4 West en Oost
jacoba18
 
最新版美国威斯康星大学拉克罗斯分校毕业证(UW–L毕业证书)原版定制
最新版美国威斯康星大学拉克罗斯分校毕业证(UW–L毕业证书)原版定制
Taqyea
 
METHODS OF DATA COLLECTION (Research methodology)
METHODS OF DATA COLLECTION (Research methodology)
anwesha248
 
MEDIA_LITERACY_INDEX_OF_EDUCATORS_ENG.pdf
MEDIA_LITERACY_INDEX_OF_EDUCATORS_ENG.pdf
OlhaTatokhina1
 
Veilig en vlot fietsen in Oost-Vlaanderen: Fietssnelwegen geoptimaliseerd met...
Veilig en vlot fietsen in Oost-Vlaanderen: Fietssnelwegen geoptimaliseerd met...
jacoba18
 
apidays Singapore 2025 - Enhancing Developer Productivity with UX (Government...
apidays Singapore 2025 - Enhancing Developer Productivity with UX (Government...
apidays
 
Data-Driven-Operational--Excellence.pptx
Data-Driven-Operational--Excellence.pptx
NiwanthaThilanjanaGa
 
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays New York 2025 - API Security and Observability at Scale in Kubernetes...
apidays
 
SAP_S4HANA_PPM_IT_Corporate_Services_Presentation.pptx
SAP_S4HANA_PPM_IT_Corporate_Services_Presentation.pptx
vemulavenu484
 
apidays New York 2025 - Breaking Barriers: Lessons Learned from API Integrati...
apidays New York 2025 - Breaking Barriers: Lessons Learned from API Integrati...
apidays
 

Machine Learning Algorithm - Logistic Regression

  • 1. Lesson 12 Machine Learning – Logistic Regression Kush Kulshrestha
  • 2. Introduction • One of the most simple algorithm used for 2 class classification problem. • Logistic Regression can be used for various classification problems such as spam detection. Diabetes prediction, if a given customer will purchase a particular product or will they churn another competitor, whether the user will click on a given advertisement link or not. • Just like Linear Regression uses optimize Least Square function to calculate the coefficients, Logistic Regression uses Log Likelihood function to find the value of the best fit parameters. • Logistic Regression is the basic algorithm used to define a Neural Network.
  • 3. Sigmoid Function Refresher The logistic function or a Sigmoid function is a function which takes any real value between zero and one. It is defined as y = 1 / (1 + e-x) where y is the scaled value and x is the input value. The logistic function transforms the original range of [-,] to [0,1] and also has a linear part on the transform.
  • 4. Probability, Odds and Log odds Probability of an event = (No of Success / Total no of cases) Odds = (One outcome / all other outcomes) Examples: Conversion: • For rolling a dice and getting 1 – Probability = (1/6) Odds = (1/5) • Rolling a dice and getting an even number – Probability = (3/6) = 0.5 Odds = (3/3) = 1 • Dice roll less than 5 – Probability = (4/6) = (2/3) Odds = (4/2) = 2
  • 5. What is Logistic Regression Linear regression is continuous response is modelled as a linear combination of the features. In Logistic regression, log-odds of a categorical response being "true" (1) is modelled as a linear combination of the features. This is called the logit function. The equation can be rearranged into the logistic function: p = Conclusion – • Logistic regression outputs the probabilities of a specific class. • Those probabilities can be converted into class predictions. • The logistic function takes on an "s" shape and is bounded by 0 and 1.
  • 6. Interpreting Logistic Regression Coefficients Final equation of Logistic regression is: Interpreting beta: ‘1’ unit increase in ‘x' is associated with a B1 unit increase in the log-odds of event for which p is probability of. Log odds are: Hence, positive coefficients increase the log-odds of the response (and thus increase the probability), and negative coefficients decrease the log-odds of the response (and thus decrease the probability).