6

I know that linear regression leads to a convex optimization problem. I'd like to visually show this with a simple example. Assume that there are two parameters (x and y) and a single data point <1, 1> with 2 as the y value (no intercept term. Then the cost function becomes

$$ (x+y-2)^2 $$

However if you plot this function you will get the figure enter image description here which contains more than one minimal point. Where is the problem in this example? Thanks

Sanyo Mn
  • 799
  • 6
  • 15

2 Answers2

6

2 parameters and a single data point is not strictly convex because the rank of the matrix of observations and predictors is deficient. Indeed, as you observe, there is a line of many "equally good" solutions, and this is because for any choice of $x$ there is a corresponding $y$ which achieves the minimum: how many points satisfy $x+y=2$?

Add more observations than predictors and the problem is (strictly) convex.

Sycorax
  • 76,417
  • 20
  • 189
  • 313
6

$$(x+y-2)^2=0$$ $$x+y=2$$ $$y=2-x$$

You can pick any $x$, and get a corresponding $y$, i.e. there's no unique solution. With two unknowns and one observation, there's not going to be a unique solution

Aksakal
  • 55,939
  • 5
  • 90
  • 176