Hacker News new | past | comments | ask | show | jobs | submit login

When you’re making a linear regression you’re minimizing the sum of squared error which is 1:1 with R2. That is, you’re getting the best possible R2 achievable with a line.

The reason we do that is because we are assuming the errors are normally distributed and finding the slope that gets the best possible R2 is equivalent to getting figuring out how to fit the line with the maximum likelihood estimator of the error (aka mean of the distribution).

So ultimately it’s about curves. If you wanted to get a sense for why this is strongly desirable you should try to fit a linear regression using absolute error instead of squared error.






Fun story: We once had a robot at a very big company you've all heard of that kept getting too close to walls when moving down hallway-like areas. The controls engineer swore he had tuned the controller to death and no further improvements could be had.

A perception engineer took one look at the controller and saw linear error terms for distance left + distance right (distance to walls), changed it to distance left^2 + distance right^2, and the whole thing magically worked beautifully. Exercise for the reader: What position in the hallway minimizes sum of distances squared, vs what position(s) in the hallway minimize sum of distances without square.

This is essentially the same problem you pose.


Kind of funny but wouldn’t you want to just maximize(distance_left, distance_right) if you wanted the center?

Edit: no, derp, just walked into the same problem lol. Maximize the min should work though


That has a unique solution, so it is infinitely better than the linear error, but is not a nice differentiable signal suitable for controls, I'd bet. But that wasn't in the problem statement.

Seems like you'd want to minimize the distance to the midpoint, but I'm probably missing something.

Fun fact: that's what sum of square does



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: