What Logistic Regression Meaning, Applications & Example
A supervised algorithm for binary classification problems.
What is Logistic Regression?
Logistic Regression is a statistical method used for binary classification tasks. It predicts the probability of a categorical dependent variable, typically with two classes, by fitting data to a logistic function. Unlike linear regression, which predicts continuous outcomes, logistic regression outputs values between 0 and 1, representing probabilities.
How Logistic Regression Works
- Linear Combination: The model computes a weighted sum of the input features.
- Sigmoid Function: The result is passed through the sigmoid function , which squashes the output between 0 and 1, indicating the probability of one class.
- Threshold: A decision boundary (usually 0.5) is applied to the probability to classify the data into one of the two classes.
Applications of Logistic Regression
- Medical Diagnosis: Predicts the presence or absence of a disease based on patient data (e.g., whether a patient has diabetes).
- Credit Scoring: Used to determine whether a loan applicant is likely to default on a loan.
- Spam Detection: Classifies emails as spam or not spam based on features like keywords or sender information.
- Customer Churn Prediction: Predicts whether a customer will cancel a subscription or leave a service.
Example of Logistic Regression
In a spam email detection task, logistic regression could predict whether an email is spam or not by analyzing features such as the frequency of certain words, the sender’s address, and the subject line. If the predicted probability of spam is greater than 0.5, the email is classified as spam; otherwise, it is classified as not spam.