Logistic regression is one of the most popular Machine Learning algorithms, which comes under the Supervised Learning technique. It is use for predicting the categorical dependent variable using a provide 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**.

it is much similar to Linear Regression except that how they are utilizee. this is in use for solving Regression problems, whereas **Logistic regression uses for solving the classification problems**.

**More about Logistic Regression**

In Logistic regression, instead of fitting a regression line, we fit an “S” shaped logistic function, which predicts two maximum values (0 or 1). The curve from the logistic function indicates the likelihood of something such as whether the cells are cancerous or not, a mouse is obese or not based on its weight, etc.

thus, it is a significant machine learning algorithm because it has the ability to provide probabilities and classify new data using continuous and discrete datasets.

It can be use to classify the observations using different types of data and can easily determine the most effective variables used for the classification. The below image is showing the logistic function:

source:https://www.javatpoint.com/logistic-regression-in-machine-learning

Look at the following diagram. It shows the distribution of data points in XY plane.

**Source: **https://www.tutorialspoint.com/machine_learning/machine_learning_supervised.htm

From the diagram, we can visually inspect the separation of red dots from green dots. You may draw a boundary line to separate out these dots. Now, to classify a new data point, you will just need to determine on which side of the line the point lies.

**Logistic Function (Sigmoid Function):**

- The sigmoid function is a mathematical function uses 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 it 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 refer 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.

**Assumptions:**

- The dependent variable must be categorical in nature.
- The independent variable should not have multicollinearity.

**Logistic Regression Equation:**

The Logistic regression equation can be obtained from the equation. The mathematical steps to get its equations are below:

- We know the equation of the straight line can be written as:

- In this, y can be between 0 and 1 only, so for this let’s divide the above equation by (1-y):

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

The above equation is the final equation.

**Type of Logistic Regression:**

On the basis of the categories, it 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 this, 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”.

**written by: Nikesh Maurya**

**Reviewed By: Krishna Heroor**

If you are Interested In Machine Learning You Can Check **Machine Learning Internship Program**

Also Check Other Technical And Non Technical **Internship Programs**