All courses › Machine Learning and Data Analysis › Sigmoid and threshold

Sigmoid and threshold

Logistic regression turns any number into a probability between 0 and 1 with the sigmoid function. Above a chosen threshold the model says yes. Lowering the threshold finds more real cases, but also gives more false alarms.

σ(z)=11+e−z\sigma(z) = \frac{1}{1 + e^{-z}}the sigmoid function
y^=1  ⟺  σ(z)≥t\hat y = 1 \iff \sigma(z) \ge tdecision with threshold t

Symbols

σ(z)\sigma(z)probability
zzlinear combination of the features
ttthreshold, often 0.5

Example

σ(0)=0.5\sigma(0) = 0.5 and σ(2)≈0.88\sigma(2) \approx 0.88.

With threshold 0.5, z=2z = 2 is classified as yes.

The threshold is a choice, not a law of nature. Choose it from what the errors cost.
Practise classification and evaluation for free →

← Precision and recall

Part of Machine Learning and Data Analysis: Classification and evaluation.