What is Logistic regression ?

An introduction to machine learning algorithms

Aviral Bhardwaj
3 min readJun 12, 2021

logistic regression is one of the most used and popular models used in machine learning.

in this article, I would be giving you a detailed explanation and how this model works.

logistic regression comes in the branch of supervised learning.

Logistic regression is a statistical model that in its basic form uses a logistic function to model a binary dependent variable.

here binary means either the answer is true or false basically(1 or 0).

the model is similar to the linear regression model.

if you have read one of my previous articles I have explained what is linear regression.

see, we are facing a problem in linear regression models so that’s why the logistic regression model comes into play.

An advantage of logistic regression is that it allows the evaluation of multiple explanatory variables by extension of the basic principles.

where does linear regression fail?

The linear regression model can work well for regression but fails for classification the model fails because it has to predict in binary (yes or no )

in linear regression, it creates a line now suppose if a variable x is high then the slope of the line would lean towards that point that would make a model bias so to correct the mistake we have created another model logistic regression which we will be used for classification

how does it work

the logistic model uses a logistic function between 0 and 1 instead of a straight line

logistic(η)=1/1+exp(−η)

the model visualization would look like

now let us take a real-life example

one of the most famous model we will learn in machine learning is predicting the survival of Titanic passengers

sounds excited? wait there’s more

in this model, we have a dataset based on which all the basic information of the passengers were given and we have also the information where they survive or not

the basic information includes — age, ticket class, family members, etc

so we put all this data into a logistic regression model and train the model.now that our model is ready we can try some examples on the model and see its outcome for the passenger and we can verify from the dataset

shortly I would be explaining this model to you by creating one and how can you predict whether the person survived or not

--

--

Aviral Bhardwaj

One of the youngest writer and mentor on AI-ML & Technology.