0% found this document useful (0 votes)
40 views9 pages

Aiml Unit 3 1

Logistic regression is a supervised machine learning classification algorithm used to predict categorical dependent variables. It fits data to an S-shaped logistic function to predict probabilities between 0 and 1, rather than concrete values as in linear regression. Key aspects include using a sigmoid function to map predictions between 0 and 1, having a categorical dependent variable, and fitting an S-curve rather than a straight line to classify observations.

Uploaded by

Gaurav patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views9 pages

Aiml Unit 3 1

Logistic regression is a supervised machine learning classification algorithm used to predict categorical dependent variables. It fits data to an S-shaped logistic function to predict probabilities between 0 and 1, rather than concrete values as in linear regression. Key aspects include using a sigmoid function to map predictions between 0 and 1, having a categorical dependent variable, and fitting an S-curve rather than a straight line to classify observations.

Uploaded by

Gaurav patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Logistic Regression

• Logistic regression :Supervised Machine Learning technique.


• It is used for predicting the categorical dependent variable using a given set of
independent variables.
• Logistic regression predicts the output of a categorical dependent variable. Therefore the
outcome must be a categorical or discrete value.
• It can be either Yes or No, 0 or 1, true or False, etc. but instead of giving the exact value
as 0 and 1, it gives the probabilistic values which lie between 0 and 1.
• Linear Regression is used for solving Regression problems, whereas Logistic regression is
used for solving the classification problems.
• In Logistic regression, instead of fitting a regression line, we fit an "S" shaped logistic
function, which predicts two maximum values (0 or 1).

2/22/2023 CSP42B: AML 1


Logistic Function (Sigmoid Function)
• The sigmoid function is a mathematical function used to map the predicted values to
probabilities. It maps any real value into another value within a range of 0 and 1.
• The value of the logistic regression must be between 0 and 1, which cannot go beyond this
limit, so it forms a curve like the "S" form. The S-form curve is called the Sigmoid function or
the logistic function.
• In logistic regression, we use the concept of the threshold value, which defines the probability
of either 0 or 1. Such as values above the threshold value tends to 1, and a value below the
threshold values tends to 0.

2/22/2023 2
Cntd..
Assumptions for Logistic Regression:
• The dependent variable must be categorical in nature.
• The independent variable should not have multi-collinearity.
Logistic Regression Equation:
We know the equation of the straight line can be written as:

In Logistic Regression y can be between 0 and 1 only, divide the above equation by (1-y):

But we need range between -[infinity] to +[infinity], then take logarithm of the equation

2/22/2023 3
Cntd..
Type of Logistic Regression:
On the basis of the categories, Logistic Regression can be classified into three types:
Binomial: In binomial Logistic regression, there can be only two possible types of the
dependent variables, such as 0 or 1, Pass or Fail, etc.

Multinomial: In multinomial Logistic regression, there can be 3 or more possible unordered


types of the dependent variable, such as "cat", "dogs", or "sheep“

Ordinal: In ordinal Logistic regression, there can be 3 or more possible ordered types of
dependent variables, such as "low", "Medium", or "High".

2/22/2023 4
Cntd..
Steps in Logistic Regression: To implement the Logistic Regression using Python, we will use the
same steps as we have done in previous topics of Regression. Below are the steps:

• Data Pre-processing step


• Fitting Logistic Regression to the Training set
• Predicting the test result
• Test accuracy of the result(Creation of Confusion matrix)
• Visualizing the test set result.

2/22/2023 5
The Logistic Regression Model
The "logit" model :

ln[p/(1-p)] = β0 + β1X

▪ p is the probability that the event Y occurs, p(Y=1)


▪ [range=0 to 1]
▪ p/(1-p) is the "odds ratio"
▪ [range=0 to ∞]
▪ ln[p/(1-p)]: log odds ratio, or "logit“
▪ [range=-∞ to +∞]

2/22/2023 CSP42B: AML 6


The Logistic Regression Model
▪ The logistic distribution constrains the estimated probabilities to lie
between 0 and 1.
▪ The estimated probability is:

p = 1/[1 + exp(-α - β X)]

▪ if you let α + β X =0, then p = .50


▪ as α + β X gets really big, p approaches 1
▪ as α + β X gets really small, p approaches 0

2/22/2023 CSP42B: AML 7


The Logistic Regression Model

2/22/2023 CSP42B: AML 8


Linear Vs Logistic

2/22/2023 CSP42B: AML 9

You might also like