Tired of ads? Enjoy an ad-free experience by signing up.
Pradeep Menon · · 5 min read

Data science simplified: Understanding logistic regression

Base photo credit: Stanley Dai.

Pradeep is a star contributor for Tech in Asia and publishes exclusive, high-value content that serves the Asian tech community. Read more from star contributors here.

In the previous article of this series, we discussed classifiers, its categories, and how they are evaluated. We’ve also previously discussed regression models in depth. In this post, we’ll dwell a little deeper in how regression models can be used for classification tasks.

Logistic regression is a widely used regression model for classification tasks. As usual, we’ll use an example to discuss this concept.

Let’s say a bank wants to build a model that predicts which of their customers will default on their loans. Their dataset is as follows:

The features in this dataset that will help us build the model are:

  • Customer ID: A unique string to identify each customer
  • Credit score: A value between 0 and 8,000 that indicates the riskiness of the borrower’s credit history
  • Loan amount: The amount that the customer either completely paid off or defaulted on
  • Years in current job: The number of years the customer has been in their current job
  • Years of credit history: The years since the first entry in the customer’s credit history
  • Monthly debt: The customer’s monthly payment for their existing loans
  • Number of credit problems: The number of credit problems that are present in the customer’s record
  • Is default: If the customer has defaulted, then this number will be 1. If not, it will be 0.

This is a classification problem.

Why not use a plain old regression model?

Logistic regression is an avatar of the regression model and transforms the regression model into a classifier. But first, let’s understand why a plain regression model won’t work as a classifier.

The target “is default” has a value of 0 or 1. So, we can reframe this as a probability, as follows:

  • If the probability of default ≥ 0.5, then the customer will default (i.e. is default = 1).
  • If the probability of default

Recall our discussion on linear regression models where we defined a dependent variable (y) which was a function of independent variables. For the sake of simplicity, let’s assume that we have only one independent variable (x). The equation becomes:

Sigmoid

Logistic regression

Conclusion

Stay ahead in Asia’s tech landscape

You've reached your 2 free content limit for the month. Sign up for free to read the full story.

🏄 For casual readers / 👶 Free

Basic

US$0

Free forever

Get instant access to this article and more every month

0 premium content

Unlimited news briefs

5

5 articles

Ad-free reading experience

Just US$0 per day

⌛Sign up in 20s. No payment details needed.

📖 For learners / 👍 Starter

Lite

US$4.92/month

Billed annually at US$59/year

Get instant access to this article and more every month

4

4 premium content

Unlimited news briefs & articles

Ad-free reading experience

Just US$0.17 per day

Cancel anytime

Our subscriber community includes professionals from these companies:

Stay updated on the go with our mobile app.

Get latest insights with smoother, more personalized experience through TIA mobile app.

Community Writer

Pradeep Menon

Pradeep is an experienced Big Data and Data Science professional with 15+ years of experience. Pradeep works as a Cloud Solution Architect (CSA)- Advanced Analytics and AI with Microsoft.