EasyDeepLearn

Why does OLS have a closed-form solution but logistic regression doesn't?

medium

Answer

  • OLS minimizes ||y - Xw||^2 which is quadratic in w — setting the gradient to zero yields the normal equations w  =  (XT  X)1w\; = \;(X^{T}\;X) - 1 XTX^{T} y, a closed form.
  • Logistic regression minimizes the log-loss which is convex but not quadratic (log of a sigmoid); its gradient has no closed-form root, so we solve it iteratively (IRLS, Newton, or SGD).
  • Both are convex, so the iterative solution reaches the unique optimum.
Check yourself — multiple choice
  • Because logistic regression is non-convex
  • OLS is quadratic in the weights so its optimum is closed-form; log-loss is convex but not quadratic
  • Logistic regression has no unique optimum
  • Logistic regression doesn't use gradients

OLS's quadratic form yields normal equations; log-loss needs iterative solvers.

#linear-regression#linear-models#optimization

Practise Supervised Learning

215 interview questions in this topic.

Related questions