offers data science lesson videos made simple!

Sign up or log in to Magoosh Data Science.

4 Logistic Regressions Examples to Help You Understand

logistic regression example -magoosh

Logistic Regression is one of the most commonly used Machine Learning algorithms that is used to model a binary variable that takes only 2 values – 0 and 1. The objective of Logistic Regression is to develop a mathematical equation that can give us a score in the range of 0 to 1. This score gives us the probability of the variable taking the value 1.

Here are some of the popularly studied examples of Logistic Regression:

Logistic Regression Example: Spam Detection

Spam detection is a binary classification problem where we are given an email and we need to classify whether or not it is spam. If the email is spam, we label it 1; if it is not spam, we label it 0. In order to apply Logistic Regression to the spam detection problem, the following features of the email are extracted:

  • Sender of the email
  • Number of typos in the email
  • Occurrence of words/phrases like “offer”, “prize”, “free gift”, etc.

The resulting feature vector is then used to train a Logistic classifier which emits a score in the range 0 to 1. If the score is more than 0.5, we label the email as spam. Otherwise, we don’t label it as spam.

Logistic Regression Example: Credit Card Fraud

The Credit Card Fraud Detection problem is of significant importance to the banking industry because banks each year spend hundreds of millions of dollars due to fraud. When a credit card transaction happens, the bank makes a note of several factors. For instance, the date of the transaction, amount, place, type of purchase, etc. Based on these factors, they develop a Logistic Regression model of whether or not the transaction is a fraud.

For instance, if the amount is too high and the bank knows that the concerned person never makes purchases that high, they may label it as a fraud.

Logistic Regression Example: Tumour Prediction

A Logistic Regression classifier may be used to identify whether a tumour is malignant or if it is benign. Several medical imaging techniques are used to extract various features of tumours. For instance, the size of the tumour, the affected body area, etc. These features are then fed to a Logistic Regression classifier to identify if the tumour is malignant or if it is benign.

Logistic Regression Example: Marketing

Every day, when you browse your Facebook newsfeed, the powerful algorithms running behind the scene predict whether or not you would be interested in certain content (which could be, for instance, an advertisement). Such algorithms can be viewed as complex variations of Logistic Regression algorithms where the question to be answered is simple – will the user like this particular advertisement in his/her news feed?

These were some of the Logistic Regression examples that would have given you a feel of its use cases. Machine learning is a huge field and Logistic Regression is just a small part of it. Keep learning more and stay tuned to Magoosh for more blogs on data science!

Comments are closed.

Magoosh blog comment policy: To create the best experience for our readers, we will only approve comments that are relevant to the article, general enough to be helpful to other students, concise, and well-written! 😄 Due to the high volume of comments across all of our blogs, we cannot promise that all comments will receive responses from our instructors.

We highly encourage students to help each other out and respond to other students' comments if you can!

If you are a Premium Magoosh student and would like more personalized service from our instructors, you can use the Help tab on the Magoosh dashboard. Thanks!