The least-squares cost function in CS229 linear-regression notes is
AJ(θ) = Σ y⁽ⁱ⁾
BJ(θ) = Σ log(h(x⁽ⁱ⁾))
CJ(θ) = Σ |h(x⁽ⁱ⁾) − y⁽ⁱ⁾|
DJ(θ) = ½ Σ (h(x⁽ⁱ⁾) − y⁽ⁱ⁾)²
Answer & Solution
Correct answer: D. J(θ) = ½ Σ (h(x⁽ⁱ⁾) − y⁽ⁱ⁾)²
Least-squares cost J(θ) = ½ Σᵢ (h_θ(x⁽ⁱ⁾) − y⁽ⁱ⁾)².
The ½ disappears under differentiation, making the gradient cleaner.
Keep practising Linear Regression and Supervised Learning
Browse all Linear Regression and Supervised Learning questions for Claude, or explore more Aifoundations topics.
Related questions
Split batch from stochastic descentThe resulting per-example log-likelihood is, up to constantsClosed-form normal equations require XᵀX to beLogistic regression uses which hypothesis function?The PROBABILISTIC justification for the least-squares cost assumes the noise ε⁽ⁱ⁾ in y⁽ⁱ⁾ The design matrix X for n training examples with d features (plus intercept) has shapeThe closed-form 'normal equations' solution for least-squares linear regression isThe LMS (Widrow–Hoff) update rule on a single training example is