Lesson 7.5: Logistic Regression
🔹 What is Logistic Regression?
Logistic Regression is a supervised learning algorithm used for classification problems (predicting discrete outcomes).
-
Predicts probability of a class (0 or 1).
-
Converts linear regression output into a probability using the sigmoid function.
Sigmoid function:
σ(z)=11+e−z\sigma(z) = \frac{1}{1 + e^{-z}}
-
Output range → 0 to 1
🔹 Key Concepts
-
Dependent Variable (Y): Categorical (Yes/No, 0/1).
-
Independent Variable(s) (X): Numeric or categorical features.
-
Decision Rule:
-
Probability ≥ 0.5 → Class 1
-
Probability < 0.5 → Class 0
-
🔹 Example
Predicting whether a student passes (1) or fails (0) based on study hours:
-
X_train→ Study hours -
y_train→ Pass/Fail -
y_pred→ Predicted class
🔹 Advantages
-
Simple and effective for binary classification.
-
Outputs probabilities, useful for decision-making.
-
Can handle multiple features.
✅ Quick Recap:
-
Logistic Regression → Classification algorithm for binary outcomes.
-
Uses sigmoid function to map predictions to probabilities.
