Course contentsShow
← Machine Learning and Deep Learning
Lesson 247 of 3,5384. Classification with Logistic RegressionFree lesson

Logistic Regression Model Formulation

Defining the logistic regression hypothesis as a linear combination followed by sigmoid activation.

Logistic Regression Model Formulation

What You'll Learn

You'll learn how logistic regression combines linear operations with the sigmoid function to produce probability predictions for classification.

The Core Idea

Logistic regression doesn't abandon everything you learned about linear models—it builds on top of them. The model works in two steps:

  1. Linear combination: Just like linear regression, we compute a weighted sum of input features
  2. Sigmoid activation: We pass that linear result through the sigmoid function to get a probability

Think of it like a two-stage filter: first, you measure evidence (the linear part), then you convert that evidence into a probability of belonging to the positive class (the sigmoid part).

The Mathematical Formulation

The logistic regression hypothesis combines what you've already learned:

Step 1 - Linear combination (z):

z = w₀ + w₁x₁ + w₂x₂ + ... + wₙxₙ

This is identical to linear regression—a weighted sum of features plus a bias term.

Step 2 - Sigmoid activation:

ŷ = σ(z) = 1 / (1 + e⁻ᶻ)

The sigmoid function (which you learned in the previous lesson) transforms z into a probability between 0 and 1.

Why This Works

The linear part (z) can output any value from negative infinity to positive infinity. But we need probabilities for classification! The sigmoid function squashes that unlimited range into [0, 1], giving us P(y=1|x)—the probability that an input belongs to the positive class.

When z is large and positive, σ(z) approaches 1. When z is large and negative, σ(z) approaches 0. When z=0, σ(z)=0.5 (right on the decision boundary).

Key Takeaway: Logistic regression = linear combination (evidence gathering) + sigmoid function (probability conversion), turning regression machinery into a probabilistic classifier.