Logistic Regression as a One-Layer Classifier

A binary linear classifier first computes an affine score:

z = x · w + b

Logistic regression converts that score, also called a logit, into a class-1 probability with the sigmoid function:

p(y=1x)=σ(z)=11+ez.p(y=1 \mid x) = \sigma(z) = \frac{1}{1 + e^{-z}}.

Read this as: “the probability of class 1 given input x equals sigmoid of the logit.” The model has one affine layer followed by a fixed probability conversion.

Three anchor points make the conversion easier to read:

z = 0       -> probability = 0.5
z positive  -> probability greater than 0.5
z negative  -> probability less than 0.5

The usual 0.5 probability threshold therefore matches the zero-score boundary. The class names are a convention: class 1 is whichever outcome the dataset encodes as 1.

Compute One Probability

Let x = [2, 1], w = [1, -1], and b = 0. The logit is:

z = 2 * 1 + 1 * (-1) + 0 = 1

Then:

sigmoid(1) = 1 / (1 + exp(-1))
           ≈ 0.731

The model assigns about 73.1% probability to class 1. This is a model probability, not a guarantee that seven of ten individually predicted events will occur.

Turn one logit into a probability

Change the features, weights, or bias and compare the logit's sign with the probability.

Runs locally with Python in your browser.

Ready to run.

Exercise: Zero logit

What class-1 probability does logistic regression assign when the logit is 0?

Compute it first, then check your number.

HintSubstitute zero into sigmoid

Use exp(0) = 1.

SolutionZero maps to one half

sigmoid(0) = 1 / (1 + exp(0)) = 1 / (1 + 1) = 0.5.

Exercise: Logit sign and class side

At a 0.5 probability threshold, does a negative logit lie on the class-1 side?

Choose one

Select one choice, then check.

HintUse the anchor point

Sigmoid maps zero to 0.5 and increases with the logit.

SolutionNegative logits map below one half

No. Because sigmoid is increasing and sigmoid(0) = 0.5, every negative logit maps to a probability below 0.5.

Research Note

D. R. Cox's 1958 paper “The Regression Analysis of Binary Sequences” developed binary regression using the logistic form. Our one-layer classifier is the same core model written in modern neural-network notation. Loss and parameter fitting arrive later in the Losses for Learning chapter.