News for hackers. Stuff that matters.
Re:Machine learning works spectacularly well, but mathematic... by yummyfajitas on Friday December 04, 2015 @08:29AM (#10676168)
Actually the squaring was for a more practical reason. Lets try to minimize the sum of the distance, oops |y-ax| is not differentiable so we can't use calculus, lets square it instead.

We later realized this worked so well because it's max likelihood of the model y=ax+b+e where e is a gaussian error function. But that came much later.

Re:Machine learning works spectacularly well, but mathematic... by tel on Friday December 04, 2015 @08:50AM (#10676259)
In grad school I asked that so many times trying to figure out why it was the "right" solution and this historical cheat caused so much cognitive dissonance.

Then again, on the other hand, "calculus works nicely" and "it's simple" probably are good spooky directors toward useful models anyway.

Re:Machine learning works spectacularly well, but mathematic... by senekerim on Friday December 04, 2015 @09:34AM (#10676492)
It's not really a cheat, as it produces the MLE (i.e. most likely) estimate under certain assumptions (e.g. errors are normally distributed, which occurs naturally if the errors are large sums of many unrelated measurements errors).
Re:Machine learning works spectacularly well, but mathematic... by tel on Friday December 04, 2015 @09:41AM (#10676537)
Oh, I'm aware. It's just hard to always justify it and especially hard to do so in historical context.
Re:Machine learning works spectacularly well, but mathematic... by alexmlamb on Friday December 04, 2015 @04:14PM (#10679174)
I don't think that this is quite the right explanation.

|y - wx| isn't differentiable but it is subdifferentiable. So the derivative is defined at every point except where y = wx, and in that case you're more or less fine if you just pretend that the derivative is zero at that point.

One reason why squaring is preferred is that the derivative has a nice closed form, which can be used to find closed form solutions.

Another is that people like to fit their models with gradient descent, and gradient descent has better guarantees for strongly convex loss functions. It also works better in practice. Intuitively: if you try to minimize x^2 by gradient descent, you have the largest gradients when you're far from the minimum. If you try to minimize |x|, then your gradient is always either +1 or -1, making it harder to converge around the minimum. See the Huber loss for a strongly convex relaxation of the absolute value function.