Logistic Regression

Abhijat Bisht
3 min readJan 15, 2021


It is the supervised learning method for binary classification problems (problems with two class values).

Logistic Regression was used in the biological sciences in early twentieth century. It was then used in many social science applications. Logistic Regression is used when the dependent variable(target) is categorical.

For example,

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

Consider a scenario where we need to classify whether an email is spam or not. If we use linear regression for this problem, there is a need for setting up a threshold based on which classification can be done. Say if the actual class is malignant, predicted continuous value 0.4 and the threshold value is 0.5, the data point will be classified as not malignant which can lead to serious consequence in real time.

Logistic Regression pipeline:-

Data Preparation


Create Train & Test


Decision Boundary

# Data Preparation

# Data Normalization mean we want entire data to have 0 mean and unit standard deviation

# Logistic Regression Implementation

# To find the line

# Decision Surface



Abhijat Bisht