✅ Logistic Regression Basics 🤖📊👉 After predicting numbers (Linear Regression), now we predict categories.
🔹 1. What is Logistic Regression?Logistic Regression is used for classification problems.
👉 Output is NOT a number — it’s a category.
Examples:
✔ Spam or Not Spam
✔ Pass or Fail
✔ Fraud or Not Fraud
🔥 2. How it WorksInstead of a straight line, it uses a Sigmoid Function:
\sigma(x) = 1 / (1 + e⁻)}
👉 Output is always between 0 and 1
👉 This is treated as probability
🔹 3. Decision Boundary👉 If probability > 0.5 → Class 1
👉 If probability < 0.5 → Class 0
🔹 4. Example👉 Predict if a student passes:
Study Hours Result
2 Fail
5 Pass
👉 Model learns boundary between pass/fail.
🔹 5. Implementationfrom sklearn.linear_model import LogisticRegression
# Sample data
X = [[1], [2], [3], [4]]
y = [0, 0, 1, 1]
model = LogisticRegression()
model.fit(X, y)
print(model.predict([[3]]))
🔹 6. Important Terms ⭐✔ Classification → Predict category
✔ Probability → Output (0–1)
✔ Threshold → Decision boundary
🔹 7. Why Logistic Regression is Important?✔ Used in real-world classification problems
✔ Foundation for advanced classification models
✔ Easy to understand and implement
🎯 Today’s Goal✔ Understand classification
✔ Learn sigmoid function
✔ Understand probability output
💬
Tap ❤️ for more!