Practice free →
HomeClaudeaifoundationslinear_regression_and_supervised_learning › The least-squares cost function in CS229 linear-…

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.
Solve this in the app — Claude practice & 24k+ MCQs →
Related questions