Problem. Given features X (n × d) and labels y ∈ {0, 1}, learn weights w and bias b so that
p = sigmoid(X w + b), sigmoid(z) = 1 / (1 + e^(−z))
loss = −mean( y · log p + (1 − y) · log(1 − p) ) (log loss, binary cross-entropy)
is minimised, using gradient descent. Return w, b and the training loss curve.
The gradient has a famously clean form: ∂loss/∂w = Xᵀ (p − y) / n and ∂loss/∂b = mean(p − y). The interview is about the details around it: computing it without loops, keeping sigmoid and log from overflowing or returning log(0), verifying the gradient, and making gradient descent actually converge.
ML context. Logistic regression is the baseline classifier, the output layer of every binary neural classifier, and the model behind click-through prediction and calibration. Its loss is the binary case of softmax cross-entropy (lesson 15.6), and the stable way to compute it (from logits, with logaddexp) is exactly how deep-learning libraries do it.