- rishabhdwivedi062

# Understand logistic regression and logit function in depth.

Updated: Nov 2, 2022

Logistic Regression is a classification algorithm where we only have two choices either **true **or **false.**

A categorical target variable is used for doing prediction, and a categorical variable is one that represents characteristics and can't be measured or counted.

**Here the probability lies in a range of 0 and 1.**

If the probability lies between **0 **to **1**, then why can't we use **Logistic Regression**?

Because it is susceptible to outliers, due to outliers threshold points can shift.

Due to the interpretation of the model.

Since it is a type of classification problem, but still used Regression in its name, which is because we need continuous values in the range of 0 to 1.

We need to modify the linear regression equation for achieving this task and need to implement a new **logit **function.

**Logit Function:-**

It is a function that has a range between **0 **and **1**, irrespective of any input it will always give output between **0** and **1**.

If **(mx+c)** is high then the overall Y value comes out to be **1**.

If **(mx+c )** is low(or negative) then the overall Y value comes out to be **0**.

Hence we are getting a new **S-shaped** curve.

Example: If the probability comes out to be **0.8** then it belongs to class **1**.

Therefore if the probability is greater than 0.5 then it belongs to class 1 else class 0.