Skip to content
Glacius
StatisticsConcept reference

Logistic probabilities

The supplied logistic link maps a real linear score z to p=1/(1+exp(-z)).

On this page 9 sections
  1. Overview
  2. A logistic function turns an unrestricted scalar score into a number between 0 and 1
  3. At z=0, the exponential is 1, so p=1/(1+1)=0.5
  4. For an event score z=1+2x at x=1, first compute z=3
  5. Turning probabilities into class labels requires a separate decision threshold
  6. Key takeaway
  7. Further questions
  8. Sources & further reading
  9. Concept connections

01A logistic function turns an unrestricted scalar score into a number between 0 and 1#

A logistic function turns an unrestricted scalar score into a number between 0 and 1. In a binary prediction model, that number represents the forecast probability of the class labeled 1. The score may come from a weighted feature sum.

A score can be any real number. This curve maps it into a probability: score 0 lands at 0.5, with negative and positive scores on opposite sides.

The curve p=1/(1+exp(-z)) rises from near zero for negative scores to near one for positive scores. The score axis runs from -4 to 4; probability runs 0 to 1. At score 0 the marked point is p=0.5. Numeric labels identify both axes.The curve p=1/(1+exp(-z)) rises from near zero for negative scores to near one for positive scores. The score axis runs from -4 to 4; probability runs 0 to 1. At score 0 the marked point is p=0.5. Numeric labels identify both axes.
Figure 1The curve p=1/(1+exp(-z)) rises from near zero for negative scores to near one for positive scores. The score axis runs from -4 to 4; probability runs 0 to 1. At score 0 the marked point is p=0.5. Numeric labels identify both axes.
Link to this figure ↗Download SVGDownload PNG

The supplied logistic link uses the negative score inside the exponential. Add 1 in the denominator, then take the reciprocal.

p=11+ezp=\frac{1}{1+e^{-z}}

At score z=0z=0, ez=1e^{-z}=1, so 1/(1+ez)=1/21/(1+e^{-z})=1/2. At score z=log3z=\log 3 using the natural logarithm, ez=1/3e^{-z}=1/3, so the probability is 1/(1+1/3)=3/41/(1+1/3)=3/4. A positive score therefore gives a probability above one half.

Check your reasoning

z=1z=1. p=1/(1+ez)p=1/(1+e^{-z}). e1=0.3679e^{-1}=0.3679. Give pp to 3 decimals.

Show answer and explanation
0.731

1/(1+0.3679)0.7311/(1+0.3679)\approx 0.731.

02At z=0, the exponential is 1, so p=1/(1+1)=0.5#

At z=0z=0, the exponential is 1, so p=1/(1+1)=0.5p=1/(1+1)=0.5. At z=2z=2, use e20.1353e^{-2}\approx0.1353: p1/1.1353=0.881p\approx1/1.1353=0.881. Reversing the score sign gives the opposite probability.

Check your reasoning

z=2z=-2. p=1/(1+ez)p=1/(1+e^{-z}). e2=7.3891e^{2}=7.3891. Reported p=0.881p=0.881. Repair to 3 decimals.

  1. A0.881
  2. B0.119
  3. C0.135
Show answer and explanation
0.119

1/(1+7.3891)0.1191/(1+7.3891)\approx 0.119.

03For an event score z=1+2x at x=1, first compute z=3#

For an event score z=1+2xz=1+2x at x=1x=1, first compute z=3z=3. Then e30.0498e^{-3}\approx0.0498 gives p0.953p\approx0.953. Apply the link once to the complete score. Finite scores never give exactly 0 or 1.

Check your reasoning

Event score z=0.5xz=0.5-x at x=2x=2. p=1/(1+ez)p=1/(1+e^{-z}). e0.5=0.6065e^{-0.5}=0.6065; e1.5=4.4817e^{1.5}=4.4817; e2=7.3891e^{2}=7.3891. Give pp to 3 decimals.

Show answer and explanation
0.182

1/(1+4.4817)0.1821/(1+4.4817)\approx 0.182.

04Turning probabilities into class labels requires a separate decision threshold#

Turning probabilities into class labels requires a separate decision threshold. A forecast 0.75 does not guarantee this particular example belongs to class 1. Calibration and evaluation assess how such probabilities behave across cases.

Key takeaway

Compute the full score, negate it inside the exponential, then take 1 divided by 1 plus that exponential.

  • Convert a linear score to a probability through a supplied logistic link.

Further questions

Does this probability formula fit the model coefficients?
No. This lesson evaluates a supplied score and link. Estimating coefficients requires a separate fitting procedure.

Sources & further reading

  1. [1]

Reference this concept

Link to this page, a section, or an individual figure.

Glacius. “Logistic probabilities.” Math behind ML. /learn/s-logistic