Archive — one question answered
Sigmoid: what is p when z = 0?
Why is spam probability at z = 0 equal to 0.5, not 0?
Sigmoid maps a linear score to a probability :
At : , so . The neuron is maximally undecided — neither spam nor normal. Beginners often think means “definitely not spam”; it is the midpoint.
Numeric examples: ; . The curve saturates: large pushes near 0 or 1 but never hits the boundary — useful for training gradients.
import math
def sigmoid(z):
return 1 / (1 + math.exp(-z))
assert abs(sigmoid(0) - 0.5) < 1e-9When filtering mail you compare to a threshold (say ). Knowing explains the quiz without memorizing answers. If you raise the threshold to , you label spam only when is large enough for sigmoid to pass 0.7 — a business choice, not a property of the curve. Lesson two in the course reuses the same formula on the toy inbox vectors, so the quiz question about is tied to real feature counts, not a trick number.