Earlier quoted context omitted.
Yes, but why ? Right tool for the right job and all that...
Normally the reason you write anything beyond trivial SQL is because you only have a small amount of code to run and lots of data to run it over. Pushing the code to the data is more efficient than pulling the data to the code. The latter might be conceptually cleaner (though it's debatable, relational is a fairly nice programming model and a lot more consistent and well-founded than object orientation, for one), but…
Linear regression by hand
31–36 of 36 posts
Re: Linear regression by hand
#32Can someone explain to me why this has (so many) upvotes? This is like elementary undergraduate econ stats and kind of trivial? There's very little content either, it's literally a reformulation of the formula, no interesting graphs or geometric interpretation. What I expected from a title like "Linear Regression By Hand" was the minimization of some quadratic error function, by hand (i.e. using pencil and paper).
Re: Linear regression by hand
#33I remember being blown away as an undergrad that least squares (which I had learned first algrebraiclly) had such an obvious geometric meaning: http://www.statisticshowto.com/wp-content/uploads/2014/11/le... You need to square the values so that points that positives and negative differences (between the points and the trend regression line) don't cancel out.
If you only needed to do that, you could just take the abs error (Even the 1-0 loss function, where every point that the regression hyperplane doesn't pass through contributes 1 to the error, fulfills this criterion).
Re: Linear regression by hand
#34It's way more fun to know how to derive least squares than to memorize some formula: https://see.stanford.edu/materials/lsoeldsee263/05-ls.pdf (page 4)
Also useful to understand least squares as a special case of maximum likelihood estimation. MLE I think is very intuitive.
Re: Linear regression by hand
#35Re: Linear regression by hand
#36Earlier quoted context omitted.
I would guess access to the data is a decent reason to try. No need to pump the data elsewhere, if this is available. I share your doubt that this is worth it, to be clear.
In this case the amount of data and the frequency with which it needs to be updated made handling this in MySQL more practical. I otherwise would've had to have some process querying and updating the records outside of MySQL and it turns out that that puts a whole lot more load on the server than if I just ask MySQL to do it. And besides, what happened to the hacker ethos? "Because I can" should be justification enou…