0% found this document useful (0 votes)
44 views12 pages

Logistic Regression

Uploaded by

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

Logistic Regression

Uploaded by

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

Logistic Regression

Logistic Regression

• Logistic regression models the probabilities for


classification problems with two possible outcomes.

• Logistic Regression is used when the dependent


variable(target) is categorical.
• For example,

To predict whether an email is spam (1) or (0)

Whether the tumor is malignant (1) or not (0)


Logistic Regression
• Logistic regression can be used to classify an observation into one of two classes
(like ‘positive sentiment’ and ‘negative sentiment’), or into one of many classes.
• In Logistic regression, instead of fitting a regression line, we fit an "S" shaped
logistic function, which predicts two maximum values (0 or 1).
Linear Regression Vs Logistic Regression

The predicted value gets converted into probability by feeding it to


the sigmoid function.
The equation of sigmoid:
Or
Logistic Regression Algorithm
• For example, An organization wants to determine an
employee’s salary increase based on their performance.

A linear regression
algorithm will help them
decide.

what if the organization


wants to know whether an
employee would get a
promotion or not based on
their performance
Logistic Regression Algorithm
• The linear graph won’t be suitable in such case. As
such, we clip the line at zero and one and convert it into
a sigmoid curve (S curve).
• To understand logistic regression, let’s go over the odds of

• Odds (𝜃) = Probability of an event happening / Probability


success.

𝜃=p/1-p
of an event not happening

• The values of odds range from zero to ∞ and the values of


probability lie between zero and one.
𝑦 = 𝛽0 + 𝛽1* 𝑥
• Consider the equation of a straight line:

• Now to predict the odds of success, we use the following


formula:

Exponentiating both the sides, we


have:
Classification with Logistic
Regression
• The sigmoid function from the prior section thus gives us a way to
take an instance x and compute the probability P(y = 1|x).

• The decision boundary:

The equation for logistic regression is:


Types of Logistic Regression
1. Binary Logistic Regression

The categorical response has only two 2 possible outcomes. Example:


Spam or Not

2. Multinomial Logistic Regression

Three or more categories without ordering. Example: Predicting which food


is preferred more (Veg, Non-Veg, Vegan)

3. Ordinal Logistic Regression

Three or more categories with ordering. Example: Movie rating from 1 to 5


Logistic Regression Assumptions

• In the case of binary logistic regression, the target


variables must be binary always and the desired
outcome is represented by the factor level 1.

• There should not be any multicollinearity in the model,


which means the independent variables must be
independent of each other.

• We must include meaningful variables in our model.

• We should choose a large sample size for logistic


regression.

You might also like