Turn a score into a probability
Logistic regression forms a weighted score and sends it through sigmoid to produce a 0-to-1 output.
The idea
First combine the clues into one score, then squeeze that score into a number between 0 and 1 so it can be read as a probability-like output.
z = w·x + b, then p = σ(z). The sigmoid is monotonic: larger z means larger p. A chosen threshold converts p into a binary class decision.
How it works
- Scale/encode features as required by the solver and data.
- Compute the linear logit z = w·x + b.
- Apply sigmoid for binary probability or softmax/multinomial formulation for multiclass settings.
- Fit coefficients by minimizing penalized log loss; choose an operating threshold using validation evidence and application costs.
Logit, sigmoid, and log loss
The logit is linear in the features; sigmoid makes it bounded; log loss strongly penalizes confident wrong probabilities.
z = w·x + b, p = 1/(1+e⁻ᶻ), ℓ = −[y log p + (1−y) log(1−p)]
Check your understanding
What happens immediately before sigmoid in logistic regression?
- The weighted score z is computed
- The test set is deleted
- A tree is grown
- K nearest points are selected
Answer and explanation
The model first computes the linear score z = w·x + b. Sigmoid then maps that score into the 0-to-1 range.
A common misconception
The sigmoid output is not ‘confidence’ in a universal sense. It is the model’s probability estimate under its fitted assumptions and may require calibration checks.
Open Logistic Regression visualizer
ML Basics
Learn the learning loop before diving into individual models: data, splits, regression, and probabilities.