SlideShare a Scribd company logo
1 of 22
Logistic
Regression
Machine Learning
Introduction
Used to predict binary outcomes for a given set
of independent variables.
One of the algorithms used for classification as
it contains categorical values.
The name may be a little confusing because it
has โ€˜regressionโ€™ in it, but it is actually used for
performing classification as the output is
discrete instead of continuous numerical value.
LOGISTIC REGRESSION 2
Explanation
Logistic Regression is a type of statistical model that is used to predict the
probability of a certain event happening. It works by taking input variables and
transforming them into a probability value between 0 and 1, where 0 represents a
low probability and 1 represents a high probability.
For example, imagine you want to predict whether someone will buy a product
based on their age and income. Logistic Regression would take these input
variables and use them to calculate the probability of the person buying the
product.
It's called "logistic" because the transformation of the input variables is done
using a mathematical function called the logistic function, which creates an S-
shaped curve.
Overall, Logistic Regression is a useful tool for making predictions and
understanding the relationship between variables in a dataset.
LOGISTIC REGRESSION 3
Example
Imagine itโ€™s been several years since you service your car.
LOGISTIC REGRESSION 4
One day you are wonderingโ€ฆ
If your car will break down in near future or not.
So this is like classification, as we will have answers
either in โ€˜Yesโ€™ or โ€˜Noโ€™.
Years since service
Probability
of
breakdown
As we can imagine that the no. of years that are on lower side
like 1 year, 2 year, 3 year after the service, the chances of the
car breaking down is very limited.
Here, the dependent variableโ€™s output is discrete.
Why not Linear Regression?
Take for example,
You ae given a data of Employee ratings along with
the probability of getting promotion.
If we are going to plot Linear Regression with Yes or
No (considering 0 as No and 1 as Yes) the graph will
certainly be look like this.
In the graph, we can see that the output is either 0
or 1, there is nothing in between as the output is discrete in
this case.
Whereas Employee rating is a continuous number
so there will not be any issue while plotting it on x-axis.
LOGISTIC REGRESSION 5
Employee Rating
Probability
of
getting
pomotion
Why not Linear Regression?
LOGISTIC REGRESSION 6
Employee Rating
Probability
of
getting
pomotion
As you can see that the graph doesnโ€™t look very right.
There would be lot of errors and RMSE would be very, very
high. Also, the values of output cannot go beyond 0 or 1.
Therefore, instead of using linear regression, we
need to come up with something different. So, the logistic
model came in picture.
Odds of Success
To understand Logistic Regression, letโ€™s talk about the odds of success.
Odds(ฮธ) =
๐‘ƒ๐‘Ÿ๐‘œ๐‘๐‘Ž๐‘๐‘–๐‘™๐‘–๐‘ก๐‘ฆ ๐‘œ๐‘“ ๐‘Ž๐‘› ๐‘’๐‘ฃ๐‘’๐‘›๐‘ก โ„Ž๐‘Ž๐‘๐‘๐‘’๐‘›๐‘–๐‘›๐‘”
๐‘ƒ๐‘Ÿ๐‘œ๐‘๐‘Ž๐‘๐‘–๐‘™๐‘–๐‘ก๐‘ฆ ๐‘œ๐‘“ ๐‘Ž๐‘› ๐‘’๐‘ฃ๐‘’๐‘›๐‘ก ๐‘›๐‘œ๐‘ก โ„Ž๐‘Ž๐‘๐‘๐‘’๐‘›๐‘–๐‘›๐‘”
or, ฮธ =
๐‘
1 โˆ’๐‘
(
๐‘ƒ๐‘Ÿ๐‘œ๐‘๐‘Ž๐‘๐‘–๐‘™๐‘–๐‘ก๐‘ฆ ๐‘œ๐‘“ ๐‘”๐‘’๐‘ก๐‘ก๐‘–๐‘›๐‘” ๐‘๐‘Ÿ๐‘œ๐‘š๐‘œ๐‘ก๐‘–๐‘œ๐‘›
๐‘ƒ๐‘Ÿ๐‘œ๐‘๐‘Ž๐‘๐‘–๐‘™๐‘–๐‘ก๐‘ฆ ๐‘œ๐‘“ ๐‘›๐‘œ๐‘ก ๐‘”๐‘’๐‘ก๐‘ก๐‘–๐‘›๐‘” ๐‘๐‘Ÿ๐‘œ๐‘š๐‘œ๐‘ก๐‘–๐‘œ๐‘›
)
The value of Odds range from 0 to ฮฑ.
The values of probability ranges from 0 to 1.
If p = 0, ฮธ = 0/(1-0) = 0/1 = 0
If p = 1, ฮธ = 1/(1-1) = 1/0 = ฮฑ
LOGISTIC REGRESSION 7
Predicting Odds of Success
log
๐‘ ๐‘ฅ
1โˆ’๐‘ ๐‘ฅ
= ฮฒ0 + ฮฒ1x (ฮฒ0 = constant)
Exponentiating both sides,
e^ln(
๐‘ ๐‘ฅ
1 โˆ’ ๐‘ ๐‘ฅ
) = e^(ฮฒ0 + ฮฒ1x )
Or,
๐‘ ๐‘ฅ
1โˆ’๐‘ ๐‘ฅ
= e^(ฮฒ0 + ฮฒ1x )
Let, Y = e^(ฮฒ0 + ฮฒ1x )
Then,
๐‘ ๐‘ฅ
1โˆ’๐‘ ๐‘ฅ
= Y
LOGISTIC REGRESSION 8
Predicting Odds of Success
Then,
๐‘ ๐‘ฅ
1โˆ’๐‘ ๐‘ฅ
= Y
or, p(x) = Y(1-p(x))
or, p(x) = Y โ€“ Y p(x)
or, p(x) + Y p(x) = Y
or, p(x) (1 + Y) = Y
or, p(x) =
๐‘Œ
1+๐‘Œ
LOGISTIC REGRESSION 9
Predicting Odds of Success
or, p(x) =
๐‘Œ
1+๐‘Œ
or, p(x) =
e^(ฮฒ0 + ฮฒ1x )
1+e^(ฮฒ0 + ฮฒ1x )
[Sigmoid]
The equation of a sigmoid function,
p(x) =
e^(ฮฒ0 + ฮฒ1x )
1+e^(ฮฒ0 + ฮฒ1x )
p(x) =
1
1+e^โˆ’(ฮฒ0 + ฮฒ1x )
LOGISTIC REGRESSION 10
Compare Linear regression
and Logistic regression
๏ƒผ Used to solve Regression problems.
๏ƒผ The response variable is continuous
in nature.
๏ƒผ It helps eliminate the dependent
variable when there is a change in the
independent variable.
๏ƒผ It is a straight line.
๏ƒผ Used to solve classification
problems.
๏ƒผ The response variable is categorical
in nature.
๏ƒผ It helps calculate the possibility of a
particular event taking place.
๏ƒผ It is a S โ€“ curve. (S = Sigmoid)
LOGISTIC REGRESSION 11
Linear Regression Logistic Regression
Compare Linear regression
and Logistic regression
๏ƒผ Example:
๏ƒผ Weather Prediction
๏ƒผ If we need to predict the
temperature of the coming
week.
๏ƒผ Then it is a continuous
number.
๏ƒผ Example:
๏ƒผ Weather Prediction
๏ƒผ If we are going to predict
whether it would be raining
tomorrow or not.
๏ƒผ Then it is a discrete value.
๏ƒผ The predictions will be
either in โ€˜Yesโ€™ or โ€˜Noโ€™
LOGISTIC REGRESSION 12
Linear Regression Logistic Regression
Compare Logistic Regression
and Classification
Logistic regression is a statistical modeling technique used to
analyze and model the relationship between a dependent
variable (binary or dichotomous) and one or more
independent variables.
In logistic regression, the dependent variable is categorical
(i.e., it takes on a limited number of values), but it is
continuous in nature.
The goal of logistic regression is to predict the probability of
an event occurring (i.e., the dependent variable taking a
certain value) based on the values of the independent
variables.
Classification, on the other hand, is a
machine learning task that involves
assigning an input to one of several
predefined categories.
Classification can be thought of as a kind of
prediction problem, where the goal is to
predict the class or category of a given
input.
LOGISTIC REGRESSION 13
Logistic Regression Classification
Applications of
Logistic Regression
1. Fraud Detection:
Here, the binary detection
variable will be either โ€˜Detectedโ€™ or
โ€˜Not detectedโ€™.
2. Disease Diagnosis:
Here, the outcome will be
either โ€˜Positiveโ€™ or โ€˜Negativeโ€™
LOGISTIC REGRESSION 14
3. Emergency Detection:
Here, the binary detection
variable will be either โ€˜Emergencyโ€™ or
โ€˜Not Emergencyโ€™.
4. Spam Filter:
Here, the outcome will be
either โ€˜Spamโ€™ or โ€˜Not Spamโ€™
Logistic Regression
Assumptions
๏ƒ˜ Binary Outcome:
The dependent variable, also known as the outcome variable or response
variable, is binary in nature.
This means that it takes on one of two possible values, typically coded as
0 and 1, or as "success" and "failure", "yes" and "no", "true" and "false",
or some other binary coding.
The logistic regression model is designed to estimate the probability of
the "success" outcome as a function of one or more independent
variables, also known as predictors or covariates.
The logistic function, which transforms a linear combination of the
predictors into a probability between 0 and 1, is used to model the
relationship between the predictors and the outcome.
LOGISTIC REGRESSION 15
Logistic Regression
Assumptions
๏ƒ˜ Independence of errors:
Independence of errors or residuals is a critical assumption of logistic
regression.
This means that the error or residual term for each observation in the
dataset should not be related to the error or residual term for any other
observation.
Violation of this assumption can result in biased and inefficient
estimates of the logistic regression parameters, which can lead to
incorrect inferences and predictions.
One way to check for violation of the independence assumption is to
examine the residual plot, which should not show any discernible
patterns or trends over time, across groups, or as a function of the
predicted values.
If violations of independence are detected, this may indicate the need to
consider a different model or to account for correlation or clustering in
the data using more sophisticated methods, such as generalized
estimating equations or mixed-effects models.
LOGISTIC REGRESSION 16
Logistic Regression
Assumptions
๏ƒ˜ Linearity of the logit:
Linearity of the logit is a key assumption of logistic regression. This
assumption means that the relationship between the independent
variables and the log-odds of the outcome is linear. In other words, the
effect of the independent variables on the log-odds of the outcome is
constant across the range of the independent variables.
One way to check for linearity is to examine the relationship between
each independent variable and the log-odds of the outcome using a
scatterplot or other graphical method. If there is evidence of non-
linearity, such as a curve or a pattern in the plot, it may be necessary to
consider adding polynomial terms, interaction terms, or other nonlinear
transformations of the independent variables to the model. Alternatively,
if the relationship is complex, a different model may be more
appropriate, such as a generalized additive model or a machine learning
algorithm.
LOGISTIC REGRESSION 17
Logistic Regression
Assumptions
๏ƒ˜ No Multicollinearity:
The assumption of no or low multicollinearity among the independent variables
is important in logistic regression. Multicollinearity refers to a situation where
two or more independent variables are highly correlated with each other, which
can lead to problems in the estimation of the model parameters and in the
interpretation of the results.
Multicollinearity can cause unstable and imprecise estimates of the logistic
regression parameters, and may make it difficult to identify which independent
variable(s) are driving the observed effects on the outcome variable. One way to
check for multicollinearity is to calculate the correlation matrix between the
independent variables and look for high correlations (i.e., correlations greater
than 0.7 or 0.8).
If high correlations are detected, several strategies can be used to address
multicollinearity, such as removing one of the correlated variables, combining
the variables into a single index or factor, or using regularization techniques like
ridge regression or lasso regression. It is important to resolve issues related to
multicollinearity in order to ensure accurate and reliable estimates of the logistic
regression parameters.
LOGISTIC REGRESSION 18
Logistic Regression
Assumptions
๏ƒ˜ Large Sample Size:
Sample size is an important consideration in logistic regression. A relatively
large sample size is typically required to ensure stable estimates and
adequate statistical power to detect meaningful effects.
The sample size requirements for logistic regression depend on several
factors, such as the number and complexity of the independent variables, the
prevalence of the outcome in the population, and the desired level of
statistical power. As a general rule of thumb, a sample size of at least 10-15
observations per independent variable is often recommended.
If the sample size is too small, the logistic regression model may suffer from
issues such as overfitting, where the model fits the noise in the data instead
of the underlying signal, and underpowered statistical tests, where important
effects may be missed due to insufficient sample size.
In summary, a relatively large sample size is important for logistic regression
to ensure accurate and stable estimates, as well as adequate statistical power
to detect meaningful effects.
LOGISTIC REGRESSION 19
Confusion Matrix
๏ถ A confusion matrix is a table used to evaluate the performance of a machine
learning algorithm for classification tasks. It is a square matrix that compares the
actual and predicted values of a classifier.
๏ถ Let's consider an example of a binary classification problem where we have a
dataset of 100 patients with diabetes, and we want to build a model that can
predict whether a patient has diabetes or not based on their medical data. The
model output will be either "Positive" or "Negative".
๏ถ By examining the values in the confusion matrix, we can calculate various
performance metrics, such as accuracy, precision, recall, and F1-score, which can
help us evaluate the model's performance. The confusion matrix provides a clear
and concise way of visualizing the model's performance in terms of its ability to
correctly classify positive and negative cases.
LOGISTIC REGRESSION 20
Confusion Matrix
๏ถ The values in the confusion matrix are as
follows:
๏ฑ True Positives (TP): the number of
cases that were correctly classified as
positive (60 in this case).
๏ฑ False Positives (FP): the number of
cases that were incorrectly classified
as positive (15 in this case).
๏ฑ True Negatives (TN): the number of
cases that were correctly classified as
negative (15 in this case).
๏ฑ False Negatives (FN): the number of
cases that were incorrectly classified
as negative (10 in this case).
LOGISTIC REGRESSION 21
Suppose the model has
made predictions on the
test set and we have the
following results:
Predicted
Positive
Predicted
Negative
Actual
Positive 60 10
Actual
Negative 15 15
Here, we have a 2x2 matrix, where the rows represent
the actual values and the columns represent the
predicted values. The diagonal elements of the matrix
represent the correctly classified cases, and the off-
diagonal elements represent the incorrectly classified
cases
Thank you

More Related Content

What's hot

Machine Learning lecture4(logistic regression)
Machine Learning lecture4(logistic regression)Machine Learning lecture4(logistic regression)
Machine Learning lecture4(logistic regression)cairo university
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionDrZahid Khan
ย 
Regression (Linear Regression and Logistic Regression) by Akanksha Bali
Regression (Linear Regression and Logistic Regression) by Akanksha BaliRegression (Linear Regression and Logistic Regression) by Akanksha Bali
Regression (Linear Regression and Logistic Regression) by Akanksha BaliAkanksha Bali
ย 
7. logistics regression using spss
7. logistics regression using spss7. logistics regression using spss
7. logistics regression using spssDr Nisha Arora
ย 
Linear regression
Linear regressionLinear regression
Linear regressionMartinHogg9
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionYashwantGahlot1
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionDrZahid Khan
ย 
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic NetsData Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic NetsDerek Kane
ย 
Machine Learning-Linear regression
Machine Learning-Linear regressionMachine Learning-Linear regression
Machine Learning-Linear regressionkishanthkumaar
ย 
Logistic Regression | Logistic Regression In Python | Machine Learning Algori...
Logistic Regression | Logistic Regression In Python | Machine Learning Algori...Logistic Regression | Logistic Regression In Python | Machine Learning Algori...
Logistic Regression | Logistic Regression In Python | Machine Learning Algori...Simplilearn
ย 
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...Edureka!
ย 
Linear Regression Analysis | Linear Regression in Python | Machine Learning A...
Linear Regression Analysis | Linear Regression in Python | Machine Learning A...Linear Regression Analysis | Linear Regression in Python | Machine Learning A...
Linear Regression Analysis | Linear Regression in Python | Machine Learning A...Simplilearn
ย 
Visual Explanation of Ridge Regression and LASSO
Visual Explanation of Ridge Regression and LASSOVisual Explanation of Ridge Regression and LASSO
Visual Explanation of Ridge Regression and LASSOKazuki Yoshida
ย 
Multinomial Logistic Regression Analysis
Multinomial Logistic Regression AnalysisMultinomial Logistic Regression Analysis
Multinomial Logistic Regression AnalysisHARISH Kumar H R
ย 
Linear regression theory
Linear regression theoryLinear regression theory
Linear regression theorySaurav Mukherjee
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionsaba khan
ย 
Regression analysis
Regression analysisRegression analysis
Regression analysisTeachers Mitraa
ย 
Logistic regression with SPSS
Logistic regression with SPSSLogistic regression with SPSS
Logistic regression with SPSSLNIPE
ย 
Generalized linear model
Generalized linear modelGeneralized linear model
Generalized linear modelRahul Rockers
ย 

What's hot (20)

Machine Learning lecture4(logistic regression)
Machine Learning lecture4(logistic regression)Machine Learning lecture4(logistic regression)
Machine Learning lecture4(logistic regression)
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
ย 
Regression (Linear Regression and Logistic Regression) by Akanksha Bali
Regression (Linear Regression and Logistic Regression) by Akanksha BaliRegression (Linear Regression and Logistic Regression) by Akanksha Bali
Regression (Linear Regression and Logistic Regression) by Akanksha Bali
ย 
7. logistics regression using spss
7. logistics regression using spss7. logistics regression using spss
7. logistics regression using spss
ย 
Linear regression
Linear regressionLinear regression
Linear regression
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
ย 
Logistical Regression.pptx
Logistical Regression.pptxLogistical Regression.pptx
Logistical Regression.pptx
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
ย 
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic NetsData Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
Data Science - Part XII - Ridge Regression, LASSO, and Elastic Nets
ย 
Machine Learning-Linear regression
Machine Learning-Linear regressionMachine Learning-Linear regression
Machine Learning-Linear regression
ย 
Logistic Regression | Logistic Regression In Python | Machine Learning Algori...
Logistic Regression | Logistic Regression In Python | Machine Learning Algori...Logistic Regression | Logistic Regression In Python | Machine Learning Algori...
Logistic Regression | Logistic Regression In Python | Machine Learning Algori...
ย 
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
Logistic Regression in Python | Logistic Regression Example | Machine Learnin...
ย 
Linear Regression Analysis | Linear Regression in Python | Machine Learning A...
Linear Regression Analysis | Linear Regression in Python | Machine Learning A...Linear Regression Analysis | Linear Regression in Python | Machine Learning A...
Linear Regression Analysis | Linear Regression in Python | Machine Learning A...
ย 
Visual Explanation of Ridge Regression and LASSO
Visual Explanation of Ridge Regression and LASSOVisual Explanation of Ridge Regression and LASSO
Visual Explanation of Ridge Regression and LASSO
ย 
Multinomial Logistic Regression Analysis
Multinomial Logistic Regression AnalysisMultinomial Logistic Regression Analysis
Multinomial Logistic Regression Analysis
ย 
Linear regression theory
Linear regression theoryLinear regression theory
Linear regression theory
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
ย 
Regression analysis
Regression analysisRegression analysis
Regression analysis
ย 
Logistic regression with SPSS
Logistic regression with SPSSLogistic regression with SPSS
Logistic regression with SPSS
ย 
Generalized linear model
Generalized linear modelGeneralized linear model
Generalized linear model
ย 

Similar to Logistic Regression.pptx

Logistic Regression in machine learning.docx
Logistic Regression in machine learning.docxLogistic Regression in machine learning.docx
Logistic Regression in machine learning.docxAbhaBansal8
ย 
Applications of regression analysis - Measurement of validity of relationship
Applications of regression analysis - Measurement of validity of relationshipApplications of regression analysis - Measurement of validity of relationship
Applications of regression analysis - Measurement of validity of relationshipRithish Kumar
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionAyurdata
ย 
Logistic-regression.pptx
Logistic-regression.pptxLogistic-regression.pptx
Logistic-regression.pptxsherinjoyson
ย 
Logistic regression and analysis using statistical information
Logistic regression and analysis using statistical informationLogistic regression and analysis using statistical information
Logistic regression and analysis using statistical informationAsadJaved304231
ย 
Logistic Regression power point presentation.pptx
Logistic Regression power point presentation.pptxLogistic Regression power point presentation.pptx
Logistic Regression power point presentation.pptxharshasawa2003
ย 
Linear regression.pptx
Linear regression.pptxLinear regression.pptx
Linear regression.pptxssuserb8a904
ย 
Poster
PosterPoster
Posterfan yang
ย 
Supervised Learning.pdf
Supervised Learning.pdfSupervised Learning.pdf
Supervised Learning.pdfgadissaassefa
ย 
Multinomial Logistic Regression.pdf
Multinomial Logistic Regression.pdfMultinomial Logistic Regression.pdf
Multinomial Logistic Regression.pdfAlemAyahu
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regressionRupak Roy
ย 
Multinomial logisticregression basicrelationships
Multinomial logisticregression basicrelationshipsMultinomial logisticregression basicrelationships
Multinomial logisticregression basicrelationshipsAnirudha si
ย 
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai UniversityMadhav Mishra
ย 
Detail Study of the concept of Regression model.pptx
Detail Study of the concept of  Regression model.pptxDetail Study of the concept of  Regression model.pptx
Detail Study of the concept of Regression model.pptxtruptikulkarni2066
ย 
Correlation analysis
Correlation analysisCorrelation analysis
Correlation analysisAwais Salman
ย 
The future is uncertain. Some events do have a very small probabil.docx
The future is uncertain. Some events do have a very small probabil.docxThe future is uncertain. Some events do have a very small probabil.docx
The future is uncertain. Some events do have a very small probabil.docxoreo10
ย 
Introduction-to-Non-Linear-Regression.pptx
Introduction-to-Non-Linear-Regression.pptxIntroduction-to-Non-Linear-Regression.pptx
Introduction-to-Non-Linear-Regression.pptxShriramKargaonkar
ย 
Correation, Linear Regression and Multilinear Regression using R software
Correation, Linear Regression and Multilinear Regression using R softwareCorreation, Linear Regression and Multilinear Regression using R software
Correation, Linear Regression and Multilinear Regression using R softwareshrikrishna kesharwani
ย 

Similar to Logistic Regression.pptx (20)

Logistic Regression in machine learning.docx
Logistic Regression in machine learning.docxLogistic Regression in machine learning.docx
Logistic Regression in machine learning.docx
ย 
Applications of regression analysis - Measurement of validity of relationship
Applications of regression analysis - Measurement of validity of relationshipApplications of regression analysis - Measurement of validity of relationship
Applications of regression analysis - Measurement of validity of relationship
ย 
Logistic regression sage
Logistic regression sageLogistic regression sage
Logistic regression sage
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
ย 
Logistic-regression.pptx
Logistic-regression.pptxLogistic-regression.pptx
Logistic-regression.pptx
ย 
Logistic regression and analysis using statistical information
Logistic regression and analysis using statistical informationLogistic regression and analysis using statistical information
Logistic regression and analysis using statistical information
ย 
Logistic Regression power point presentation.pptx
Logistic Regression power point presentation.pptxLogistic Regression power point presentation.pptx
Logistic Regression power point presentation.pptx
ย 
Linear regression.pptx
Linear regression.pptxLinear regression.pptx
Linear regression.pptx
ย 
Poster
PosterPoster
Poster
ย 
Supervised Learning.pdf
Supervised Learning.pdfSupervised Learning.pdf
Supervised Learning.pdf
ย 
MF Presentation.pptx
MF Presentation.pptxMF Presentation.pptx
MF Presentation.pptx
ย 
Multinomial Logistic Regression.pdf
Multinomial Logistic Regression.pdfMultinomial Logistic Regression.pdf
Multinomial Logistic Regression.pdf
ย 
Logistic regression
Logistic regressionLogistic regression
Logistic regression
ย 
Multinomial logisticregression basicrelationships
Multinomial logisticregression basicrelationshipsMultinomial logisticregression basicrelationships
Multinomial logisticregression basicrelationships
ย 
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai UniversityMachine Learning Unit 3 Semester 3  MSc IT Part 2 Mumbai University
Machine Learning Unit 3 Semester 3 MSc IT Part 2 Mumbai University
ย 
Detail Study of the concept of Regression model.pptx
Detail Study of the concept of  Regression model.pptxDetail Study of the concept of  Regression model.pptx
Detail Study of the concept of Regression model.pptx
ย 
Correlation analysis
Correlation analysisCorrelation analysis
Correlation analysis
ย 
The future is uncertain. Some events do have a very small probabil.docx
The future is uncertain. Some events do have a very small probabil.docxThe future is uncertain. Some events do have a very small probabil.docx
The future is uncertain. Some events do have a very small probabil.docx
ย 
Introduction-to-Non-Linear-Regression.pptx
Introduction-to-Non-Linear-Regression.pptxIntroduction-to-Non-Linear-Regression.pptx
Introduction-to-Non-Linear-Regression.pptx
ย 
Correation, Linear Regression and Multilinear Regression using R software
Correation, Linear Regression and Multilinear Regression using R softwareCorreation, Linear Regression and Multilinear Regression using R software
Correation, Linear Regression and Multilinear Regression using R software
ย 

Recently uploaded

Full night ๐Ÿฅต Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy โœŒ๏ธo...
Full night ๐Ÿฅต Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy โœŒ๏ธo...Full night ๐Ÿฅต Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy โœŒ๏ธo...
Full night ๐Ÿฅต Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy โœŒ๏ธo...shivangimorya083
ย 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
ย 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
ย 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
ย 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
ย 
๊งโค Greater Noida Call Girls Delhi โค๊ง‚ 9711199171 โ˜Ž๏ธ Hard And Sexy Vip Call
๊งโค Greater Noida Call Girls Delhi โค๊ง‚ 9711199171 โ˜Ž๏ธ Hard And Sexy Vip Call๊งโค Greater Noida Call Girls Delhi โค๊ง‚ 9711199171 โ˜Ž๏ธ Hard And Sexy Vip Call
๊งโค Greater Noida Call Girls Delhi โค๊ง‚ 9711199171 โ˜Ž๏ธ Hard And Sexy Vip Callshivangimorya083
ย 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
ย 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
ย 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...dajasot375
ย 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
ย 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
ย 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Jack DiGiovanna
ย 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
ย 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Delhi Call girls
ย 
ๅฎšๅˆถ่‹ฑๅ›ฝ็™ฝ้‡‘ๆฑ‰ๅคงๅญฆๆฏ•ไธš่ฏ๏ผˆUCBๆฏ•ไธš่ฏไนฆ๏ผ‰ ๆˆ็ปฉๅ•ๅŽŸ็‰ˆไธ€ๆฏ”ไธ€
ๅฎšๅˆถ่‹ฑๅ›ฝ็™ฝ้‡‘ๆฑ‰ๅคงๅญฆๆฏ•ไธš่ฏ๏ผˆUCBๆฏ•ไธš่ฏไนฆ๏ผ‰																			ๆˆ็ปฉๅ•ๅŽŸ็‰ˆไธ€ๆฏ”ไธ€ๅฎšๅˆถ่‹ฑๅ›ฝ็™ฝ้‡‘ๆฑ‰ๅคงๅญฆๆฏ•ไธš่ฏ๏ผˆUCBๆฏ•ไธš่ฏไนฆ๏ผ‰																			ๆˆ็ปฉๅ•ๅŽŸ็‰ˆไธ€ๆฏ”ไธ€
ๅฎšๅˆถ่‹ฑๅ›ฝ็™ฝ้‡‘ๆฑ‰ๅคงๅญฆๆฏ•ไธš่ฏ๏ผˆUCBๆฏ•ไธš่ฏไนฆ๏ผ‰ ๆˆ็ปฉๅ•ๅŽŸ็‰ˆไธ€ๆฏ”ไธ€ffjhghh
ย 
Predicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project PresentationPredicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project PresentationBoston Institute of Analytics
ย 
Aminabad Call Girl Agent 9548273370 , Call Girls Service Lucknow
Aminabad Call Girl Agent 9548273370 , Call Girls Service LucknowAminabad Call Girl Agent 9548273370 , Call Girls Service Lucknow
Aminabad Call Girl Agent 9548273370 , Call Girls Service Lucknowmakika9823
ย 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
ย 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
ย 
High Class Call Girls Noida Sector 39 Aarushi ๐Ÿ”8264348440๐Ÿ” Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi ๐Ÿ”8264348440๐Ÿ” Independent Escort...High Class Call Girls Noida Sector 39 Aarushi ๐Ÿ”8264348440๐Ÿ” Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi ๐Ÿ”8264348440๐Ÿ” Independent Escort...soniya singh
ย 

Recently uploaded (20)

Full night ๐Ÿฅต Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy โœŒ๏ธo...
Full night ๐Ÿฅต Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy โœŒ๏ธo...Full night ๐Ÿฅต Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy โœŒ๏ธo...
Full night ๐Ÿฅต Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy โœŒ๏ธo...
ย 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
ย 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
ย 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
ย 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
ย 
๊งโค Greater Noida Call Girls Delhi โค๊ง‚ 9711199171 โ˜Ž๏ธ Hard And Sexy Vip Call
๊งโค Greater Noida Call Girls Delhi โค๊ง‚ 9711199171 โ˜Ž๏ธ Hard And Sexy Vip Call๊งโค Greater Noida Call Girls Delhi โค๊ง‚ 9711199171 โ˜Ž๏ธ Hard And Sexy Vip Call
๊งโค Greater Noida Call Girls Delhi โค๊ง‚ 9711199171 โ˜Ž๏ธ Hard And Sexy Vip Call
ย 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
ย 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
ย 
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
Indian Call Girls in Abu Dhabi O5286O24O8 Call Girls in Abu Dhabi By Independ...
ย 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
ย 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
ย 
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
Building on a FAIRly Strong Foundation to Connect Academic Research to Transl...
ย 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
ย 
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
Best VIP Call Girls Noida Sector 39 Call Me: 8448380779
ย 
ๅฎšๅˆถ่‹ฑๅ›ฝ็™ฝ้‡‘ๆฑ‰ๅคงๅญฆๆฏ•ไธš่ฏ๏ผˆUCBๆฏ•ไธš่ฏไนฆ๏ผ‰ ๆˆ็ปฉๅ•ๅŽŸ็‰ˆไธ€ๆฏ”ไธ€
ๅฎšๅˆถ่‹ฑๅ›ฝ็™ฝ้‡‘ๆฑ‰ๅคงๅญฆๆฏ•ไธš่ฏ๏ผˆUCBๆฏ•ไธš่ฏไนฆ๏ผ‰																			ๆˆ็ปฉๅ•ๅŽŸ็‰ˆไธ€ๆฏ”ไธ€ๅฎšๅˆถ่‹ฑๅ›ฝ็™ฝ้‡‘ๆฑ‰ๅคงๅญฆๆฏ•ไธš่ฏ๏ผˆUCBๆฏ•ไธš่ฏไนฆ๏ผ‰																			ๆˆ็ปฉๅ•ๅŽŸ็‰ˆไธ€ๆฏ”ไธ€
ๅฎšๅˆถ่‹ฑๅ›ฝ็™ฝ้‡‘ๆฑ‰ๅคงๅญฆๆฏ•ไธš่ฏ๏ผˆUCBๆฏ•ไธš่ฏไนฆ๏ผ‰ ๆˆ็ปฉๅ•ๅŽŸ็‰ˆไธ€ๆฏ”ไธ€
ย 
Predicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project PresentationPredicting Employee Churn: A Data-Driven Approach Project Presentation
Predicting Employee Churn: A Data-Driven Approach Project Presentation
ย 
Aminabad Call Girl Agent 9548273370 , Call Girls Service Lucknow
Aminabad Call Girl Agent 9548273370 , Call Girls Service LucknowAminabad Call Girl Agent 9548273370 , Call Girls Service Lucknow
Aminabad Call Girl Agent 9548273370 , Call Girls Service Lucknow
ย 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
ย 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
ย 
High Class Call Girls Noida Sector 39 Aarushi ๐Ÿ”8264348440๐Ÿ” Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi ๐Ÿ”8264348440๐Ÿ” Independent Escort...High Class Call Girls Noida Sector 39 Aarushi ๐Ÿ”8264348440๐Ÿ” Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi ๐Ÿ”8264348440๐Ÿ” Independent Escort...
ย 

Logistic Regression.pptx

  • 2. Introduction Used to predict binary outcomes for a given set of independent variables. One of the algorithms used for classification as it contains categorical values. The name may be a little confusing because it has โ€˜regressionโ€™ in it, but it is actually used for performing classification as the output is discrete instead of continuous numerical value. LOGISTIC REGRESSION 2
  • 3. Explanation Logistic Regression is a type of statistical model that is used to predict the probability of a certain event happening. It works by taking input variables and transforming them into a probability value between 0 and 1, where 0 represents a low probability and 1 represents a high probability. For example, imagine you want to predict whether someone will buy a product based on their age and income. Logistic Regression would take these input variables and use them to calculate the probability of the person buying the product. It's called "logistic" because the transformation of the input variables is done using a mathematical function called the logistic function, which creates an S- shaped curve. Overall, Logistic Regression is a useful tool for making predictions and understanding the relationship between variables in a dataset. LOGISTIC REGRESSION 3
  • 4. Example Imagine itโ€™s been several years since you service your car. LOGISTIC REGRESSION 4 One day you are wonderingโ€ฆ If your car will break down in near future or not. So this is like classification, as we will have answers either in โ€˜Yesโ€™ or โ€˜Noโ€™. Years since service Probability of breakdown As we can imagine that the no. of years that are on lower side like 1 year, 2 year, 3 year after the service, the chances of the car breaking down is very limited. Here, the dependent variableโ€™s output is discrete.
  • 5. Why not Linear Regression? Take for example, You ae given a data of Employee ratings along with the probability of getting promotion. If we are going to plot Linear Regression with Yes or No (considering 0 as No and 1 as Yes) the graph will certainly be look like this. In the graph, we can see that the output is either 0 or 1, there is nothing in between as the output is discrete in this case. Whereas Employee rating is a continuous number so there will not be any issue while plotting it on x-axis. LOGISTIC REGRESSION 5 Employee Rating Probability of getting pomotion
  • 6. Why not Linear Regression? LOGISTIC REGRESSION 6 Employee Rating Probability of getting pomotion As you can see that the graph doesnโ€™t look very right. There would be lot of errors and RMSE would be very, very high. Also, the values of output cannot go beyond 0 or 1. Therefore, instead of using linear regression, we need to come up with something different. So, the logistic model came in picture.
  • 7. Odds of Success To understand Logistic Regression, letโ€™s talk about the odds of success. Odds(ฮธ) = ๐‘ƒ๐‘Ÿ๐‘œ๐‘๐‘Ž๐‘๐‘–๐‘™๐‘–๐‘ก๐‘ฆ ๐‘œ๐‘“ ๐‘Ž๐‘› ๐‘’๐‘ฃ๐‘’๐‘›๐‘ก โ„Ž๐‘Ž๐‘๐‘๐‘’๐‘›๐‘–๐‘›๐‘” ๐‘ƒ๐‘Ÿ๐‘œ๐‘๐‘Ž๐‘๐‘–๐‘™๐‘–๐‘ก๐‘ฆ ๐‘œ๐‘“ ๐‘Ž๐‘› ๐‘’๐‘ฃ๐‘’๐‘›๐‘ก ๐‘›๐‘œ๐‘ก โ„Ž๐‘Ž๐‘๐‘๐‘’๐‘›๐‘–๐‘›๐‘” or, ฮธ = ๐‘ 1 โˆ’๐‘ ( ๐‘ƒ๐‘Ÿ๐‘œ๐‘๐‘Ž๐‘๐‘–๐‘™๐‘–๐‘ก๐‘ฆ ๐‘œ๐‘“ ๐‘”๐‘’๐‘ก๐‘ก๐‘–๐‘›๐‘” ๐‘๐‘Ÿ๐‘œ๐‘š๐‘œ๐‘ก๐‘–๐‘œ๐‘› ๐‘ƒ๐‘Ÿ๐‘œ๐‘๐‘Ž๐‘๐‘–๐‘™๐‘–๐‘ก๐‘ฆ ๐‘œ๐‘“ ๐‘›๐‘œ๐‘ก ๐‘”๐‘’๐‘ก๐‘ก๐‘–๐‘›๐‘” ๐‘๐‘Ÿ๐‘œ๐‘š๐‘œ๐‘ก๐‘–๐‘œ๐‘› ) The value of Odds range from 0 to ฮฑ. The values of probability ranges from 0 to 1. If p = 0, ฮธ = 0/(1-0) = 0/1 = 0 If p = 1, ฮธ = 1/(1-1) = 1/0 = ฮฑ LOGISTIC REGRESSION 7
  • 8. Predicting Odds of Success log ๐‘ ๐‘ฅ 1โˆ’๐‘ ๐‘ฅ = ฮฒ0 + ฮฒ1x (ฮฒ0 = constant) Exponentiating both sides, e^ln( ๐‘ ๐‘ฅ 1 โˆ’ ๐‘ ๐‘ฅ ) = e^(ฮฒ0 + ฮฒ1x ) Or, ๐‘ ๐‘ฅ 1โˆ’๐‘ ๐‘ฅ = e^(ฮฒ0 + ฮฒ1x ) Let, Y = e^(ฮฒ0 + ฮฒ1x ) Then, ๐‘ ๐‘ฅ 1โˆ’๐‘ ๐‘ฅ = Y LOGISTIC REGRESSION 8
  • 9. Predicting Odds of Success Then, ๐‘ ๐‘ฅ 1โˆ’๐‘ ๐‘ฅ = Y or, p(x) = Y(1-p(x)) or, p(x) = Y โ€“ Y p(x) or, p(x) + Y p(x) = Y or, p(x) (1 + Y) = Y or, p(x) = ๐‘Œ 1+๐‘Œ LOGISTIC REGRESSION 9
  • 10. Predicting Odds of Success or, p(x) = ๐‘Œ 1+๐‘Œ or, p(x) = e^(ฮฒ0 + ฮฒ1x ) 1+e^(ฮฒ0 + ฮฒ1x ) [Sigmoid] The equation of a sigmoid function, p(x) = e^(ฮฒ0 + ฮฒ1x ) 1+e^(ฮฒ0 + ฮฒ1x ) p(x) = 1 1+e^โˆ’(ฮฒ0 + ฮฒ1x ) LOGISTIC REGRESSION 10
  • 11. Compare Linear regression and Logistic regression ๏ƒผ Used to solve Regression problems. ๏ƒผ The response variable is continuous in nature. ๏ƒผ It helps eliminate the dependent variable when there is a change in the independent variable. ๏ƒผ It is a straight line. ๏ƒผ Used to solve classification problems. ๏ƒผ The response variable is categorical in nature. ๏ƒผ It helps calculate the possibility of a particular event taking place. ๏ƒผ It is a S โ€“ curve. (S = Sigmoid) LOGISTIC REGRESSION 11 Linear Regression Logistic Regression
  • 12. Compare Linear regression and Logistic regression ๏ƒผ Example: ๏ƒผ Weather Prediction ๏ƒผ If we need to predict the temperature of the coming week. ๏ƒผ Then it is a continuous number. ๏ƒผ Example: ๏ƒผ Weather Prediction ๏ƒผ If we are going to predict whether it would be raining tomorrow or not. ๏ƒผ Then it is a discrete value. ๏ƒผ The predictions will be either in โ€˜Yesโ€™ or โ€˜Noโ€™ LOGISTIC REGRESSION 12 Linear Regression Logistic Regression
  • 13. Compare Logistic Regression and Classification Logistic regression is a statistical modeling technique used to analyze and model the relationship between a dependent variable (binary or dichotomous) and one or more independent variables. In logistic regression, the dependent variable is categorical (i.e., it takes on a limited number of values), but it is continuous in nature. The goal of logistic regression is to predict the probability of an event occurring (i.e., the dependent variable taking a certain value) based on the values of the independent variables. Classification, on the other hand, is a machine learning task that involves assigning an input to one of several predefined categories. Classification can be thought of as a kind of prediction problem, where the goal is to predict the class or category of a given input. LOGISTIC REGRESSION 13 Logistic Regression Classification
  • 14. Applications of Logistic Regression 1. Fraud Detection: Here, the binary detection variable will be either โ€˜Detectedโ€™ or โ€˜Not detectedโ€™. 2. Disease Diagnosis: Here, the outcome will be either โ€˜Positiveโ€™ or โ€˜Negativeโ€™ LOGISTIC REGRESSION 14 3. Emergency Detection: Here, the binary detection variable will be either โ€˜Emergencyโ€™ or โ€˜Not Emergencyโ€™. 4. Spam Filter: Here, the outcome will be either โ€˜Spamโ€™ or โ€˜Not Spamโ€™
  • 15. Logistic Regression Assumptions ๏ƒ˜ Binary Outcome: The dependent variable, also known as the outcome variable or response variable, is binary in nature. This means that it takes on one of two possible values, typically coded as 0 and 1, or as "success" and "failure", "yes" and "no", "true" and "false", or some other binary coding. The logistic regression model is designed to estimate the probability of the "success" outcome as a function of one or more independent variables, also known as predictors or covariates. The logistic function, which transforms a linear combination of the predictors into a probability between 0 and 1, is used to model the relationship between the predictors and the outcome. LOGISTIC REGRESSION 15
  • 16. Logistic Regression Assumptions ๏ƒ˜ Independence of errors: Independence of errors or residuals is a critical assumption of logistic regression. This means that the error or residual term for each observation in the dataset should not be related to the error or residual term for any other observation. Violation of this assumption can result in biased and inefficient estimates of the logistic regression parameters, which can lead to incorrect inferences and predictions. One way to check for violation of the independence assumption is to examine the residual plot, which should not show any discernible patterns or trends over time, across groups, or as a function of the predicted values. If violations of independence are detected, this may indicate the need to consider a different model or to account for correlation or clustering in the data using more sophisticated methods, such as generalized estimating equations or mixed-effects models. LOGISTIC REGRESSION 16
  • 17. Logistic Regression Assumptions ๏ƒ˜ Linearity of the logit: Linearity of the logit is a key assumption of logistic regression. This assumption means that the relationship between the independent variables and the log-odds of the outcome is linear. In other words, the effect of the independent variables on the log-odds of the outcome is constant across the range of the independent variables. One way to check for linearity is to examine the relationship between each independent variable and the log-odds of the outcome using a scatterplot or other graphical method. If there is evidence of non- linearity, such as a curve or a pattern in the plot, it may be necessary to consider adding polynomial terms, interaction terms, or other nonlinear transformations of the independent variables to the model. Alternatively, if the relationship is complex, a different model may be more appropriate, such as a generalized additive model or a machine learning algorithm. LOGISTIC REGRESSION 17
  • 18. Logistic Regression Assumptions ๏ƒ˜ No Multicollinearity: The assumption of no or low multicollinearity among the independent variables is important in logistic regression. Multicollinearity refers to a situation where two or more independent variables are highly correlated with each other, which can lead to problems in the estimation of the model parameters and in the interpretation of the results. Multicollinearity can cause unstable and imprecise estimates of the logistic regression parameters, and may make it difficult to identify which independent variable(s) are driving the observed effects on the outcome variable. One way to check for multicollinearity is to calculate the correlation matrix between the independent variables and look for high correlations (i.e., correlations greater than 0.7 or 0.8). If high correlations are detected, several strategies can be used to address multicollinearity, such as removing one of the correlated variables, combining the variables into a single index or factor, or using regularization techniques like ridge regression or lasso regression. It is important to resolve issues related to multicollinearity in order to ensure accurate and reliable estimates of the logistic regression parameters. LOGISTIC REGRESSION 18
  • 19. Logistic Regression Assumptions ๏ƒ˜ Large Sample Size: Sample size is an important consideration in logistic regression. A relatively large sample size is typically required to ensure stable estimates and adequate statistical power to detect meaningful effects. The sample size requirements for logistic regression depend on several factors, such as the number and complexity of the independent variables, the prevalence of the outcome in the population, and the desired level of statistical power. As a general rule of thumb, a sample size of at least 10-15 observations per independent variable is often recommended. If the sample size is too small, the logistic regression model may suffer from issues such as overfitting, where the model fits the noise in the data instead of the underlying signal, and underpowered statistical tests, where important effects may be missed due to insufficient sample size. In summary, a relatively large sample size is important for logistic regression to ensure accurate and stable estimates, as well as adequate statistical power to detect meaningful effects. LOGISTIC REGRESSION 19
  • 20. Confusion Matrix ๏ถ A confusion matrix is a table used to evaluate the performance of a machine learning algorithm for classification tasks. It is a square matrix that compares the actual and predicted values of a classifier. ๏ถ Let's consider an example of a binary classification problem where we have a dataset of 100 patients with diabetes, and we want to build a model that can predict whether a patient has diabetes or not based on their medical data. The model output will be either "Positive" or "Negative". ๏ถ By examining the values in the confusion matrix, we can calculate various performance metrics, such as accuracy, precision, recall, and F1-score, which can help us evaluate the model's performance. The confusion matrix provides a clear and concise way of visualizing the model's performance in terms of its ability to correctly classify positive and negative cases. LOGISTIC REGRESSION 20
  • 21. Confusion Matrix ๏ถ The values in the confusion matrix are as follows: ๏ฑ True Positives (TP): the number of cases that were correctly classified as positive (60 in this case). ๏ฑ False Positives (FP): the number of cases that were incorrectly classified as positive (15 in this case). ๏ฑ True Negatives (TN): the number of cases that were correctly classified as negative (15 in this case). ๏ฑ False Negatives (FN): the number of cases that were incorrectly classified as negative (10 in this case). LOGISTIC REGRESSION 21 Suppose the model has made predictions on the test set and we have the following results: Predicted Positive Predicted Negative Actual Positive 60 10 Actual Negative 15 15 Here, we have a 2x2 matrix, where the rows represent the actual values and the columns represent the predicted values. The diagonal elements of the matrix represent the correctly classified cases, and the off- diagonal elements represent the incorrectly classified cases