Topic: squared-error loss for a linear score · ∂J/∂w and ∂J/∂b · one-step gradient descent · batch update · margin distance · bias term
Questions: 10 MCQ
Source: class WhatsApp group (Chats/WhatsApp-Cheat-code/chat.md), set posted 5 Nov 2026 (forwarded with the comment "I think PR 😅" — it is the linear-classifier/PR-type quiz, but the maths is core AML too).
Verification: ✅ 9 of 10 fully re-derived and correct. Q6/Q7 cannot be re-derived because the export omits the target labels
t; the method is correct (see note).
Notation used below: score y = wᵀx + b, target t, loss J = ½(y − t)², learning rate η.
Quick answer key
| Q | Answer | Q | Answer |
|---|---|---|---|
| 1 | (A) (y − t)x | 6 | (A) w₁ = 0.4, b₁ = 0.25 |
| 2 | (B) 1 | 7 | (A) same, options reshuffled |
| 3 | (B) y − t | 8 | (C) both |
| 4 | (A) w = [0.2, 0.1]ᵀ, b = 0.1 | 9 | (C) bias may be +, − or 0 |
| 5 | (C) 1 | 10 | (B) 1 (repeat of Q2) |
Q1. Gradient of J = ½(wᵀx + b − t)² with respect to w
✅ (A) (y − t)x
Chain rule: ∂J/∂w = (y − t) · ∂y/∂w, and ∂(wᵀx)/∂w = x. So the gradient is the error times the input vector. Related: this is why the update is w ← w − η(y−t)x — each feature moves in proportion to its own value. The bias gradient (Q3) has no x factor for the same reason.
Q2. ‖w‖ = 2. Distance between the hyperplanes wᵀx + b = 1 and wᵀx + b = −1
✅ (B) 1
For parallel planes at offsets c₁, c₂ the distance is |c₁ − c₂| / ‖w‖ = 2/2 = 1. Related: this is the SVM margin — 2/‖w‖ — so maximising the margin means minimising ‖w‖. If ‖w‖ were 1, the distance would be 2; a common slip is to answer 2/‖w‖ without dividing.
Q3. Gradient of the same loss with respect to b
✅ (B) y − t
∂J/∂b = (y − t) · 1. Related: the bias is updated with the raw error; the weights are updated with the error weighted by x. If a feature is always 0 for a sample, that sample cannot move that weight.
Q4. One gradient-descent step: x = [2,1]ᵀ, t = 1, w = [0,0]ᵀ, b = 0, η = 0.1
✅ (A) w = [0.2, 0.1]ᵀ, b = 0.1
y = 0 → error (y − t) = −1. w ← 0 − 0.1·(−1)·[2,1]ᵀ = [0.2, 0.1]ᵀ; b ← 0 − 0.1·(−1) = 0.1. Related: check the direction — the prediction was too low, so both w and b increase. A sign error is the standard mistake here.
Q5. w = [1,2], b = −3, x = [2,1] — discriminant output
✅ (C) 1
y = 1·2 + 2·1 − 3 = 1. Positive ⇒ classify as the positive class. Related: the magnitude is the distance to the boundary scaled by ‖w‖: distance = |y|/‖w‖ = 1/√5.
Q6/Q7. Batch update with points (1,2) and (2,3), w₀ = b₀ = 0, η = 0.1 → ✅ (A) w₁ = 0.4, b₁ = 0.25 (Q7 identical with the options reshuffled)
A batch step accumulates the gradients of all samples before updating once:
w ← w − η Σᵢ(yᵢ − tᵢ)xᵢ, b ← b − η Σᵢ(yᵢ − tᵢ).
⚠️ Note: the export does not state the targets for these two points, so the arithmetic cannot be reproduced from the text alone. The method (sum the per-sample gradients, then take one step) is what the question tests; treat the given numbers as authoritative. Related: contrast with stochastic GD, which updates after every sample, and mini-batch GD, which updates per batch — same formula, different accumulation window.
Q8. Boundary 2x₁ + 3x₂ − 6 = 0 — weight vector and bias
✅ (C) Both
Reading wᵀx + b = 0 against 2x₁ + 3x₂ − 6 = 0 gives w = [2, 3]ᵀ and b = −6. The question's (C) means both statements (w = [2,3] and b = −6) are true. Related: you may scale the whole equation by any positive constant without changing the boundary — so (2,3,−6) and (1,1.5,−3) are the same classifier.
Q9. Which statement about the bias is correct?
✅ (C) The bias can be positive, negative, or zero
b only shifts the hyperplane; nothing constrains its sign. Related: b = 0 means the boundary passes through the origin — a restriction, not a normalisation. The bias is what lets a classifier fit data whose classes are not centred on the origin.
Q10. Repeat of Q2 (‖w‖ = 2, distance between the two planes)
✅ (B) 1 — same computation: 2/‖w‖ = 1.