Logistic Regression
Despite its name, Logistic Regression is a classification algorithm, not regression. It's the foundation of classification and still widely used today.
From Linear to Logistic
Linear regression outputs any number. But classification needs probabilities (0 to 1).
The Sigmoid Function
The sigmoid function squashes any number to the range (0, 1) - perfect for probabilities!
How Logistic Regression Works
Logistic regression = linear combination + sigmoid function
The Decision Boundary
Training with Gradient Descent
Practice: Logistic Regression Prediction
Key Takeaways
- Logistic regression is for classification despite its name
- Uses the sigmoid function to output probabilities (0 to 1)
- Creates a linear decision boundary
- Threshold (usually 0.5) converts probability to class label
- Uses gradient descent with cross-entropy loss for training
- In sklearn:
LogisticRegression().fit(X, y).predict(X_new)
Next, we'll learn K-Nearest Neighbors - a completely different approach!
Quiz
Up next ยท Lesson 16 of 35
K-Nearest Neighbors
1 min read
15 of 35 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

