Although [Vitor Fróis] is explaining linear regression because it relates to machine learning, the post and, indeed, the topic have wide applications in many things that we do with electronics and computers. It is one way to use independent variables to predict dependent variables, and, in its simplest form, it is based on nothing more than a straight line.
You might remember from school that a straight line can be described by: y=mx+b. Here, m is the slope of the line and b is the y-intercept. Another way to think about it is that m is how fast the line goes up (or down, if m is negative), and b is where the line “starts” at x=0.
[Vitor] starts out with a great example: home prices (the dependent variable) and area (the independent variable). As you would guess, bigger houses tend to sell for more than smaller houses. But it isn’t an exact formula, because there are a lot of reasons a house might sell for more or less. If you plot it, you don’t get a nice line; you get a cloud of points that sort of group around some imaginary line.
There are mathematical ways to figure out what line you should imagine, but you can often eyeball it, too. The real trick is evaluating the quality of that imaginary line.
To do that, you need an error measure. If you didn’t know better, you’d probably think expressing the error in terms of absolute value would be best. You know, “this is 10 off” or whatever. But, as [Vitor] explains, the standard way to do this is with a squared error term R2. Why? Read the post and find out.
For electronics, linear regression has many applications, including interpreting sensor data. You might also use it to generalize a batch of unknown components, for example. Think of a batch of transistors with different Beta values at different frequencies. A linear regression will help you predict the Beta and the error term will tell you if it is worth using the prediction or not. Or, maybe you just want to make the perfect cup of coffee.
Knowledge of regression, curve fitting and statistics is immensely helpful for engineers and software folk. Spend a few afternoons just exploring these fields and you will gain amazing tools to do whatever you want with them.
I don’t know why they are never given the attention they deserve in univ
At least in Germany, e.g. in normal Computer Science, you take directly a Mashine Learning or AI course or what I had, was “Statistics with R”, where we learned the theory and had practical use in R of several statistics – including lin. regression or model fitting etc.
Can’t remember what language we used in Ireland a long time ago, but statistics was a heavy part of any “Computing” (Comp Science) course.
xkcd #2048 is exceptionally relevant to this. Doing linear regression well with a big dataset is difficult! I do this all the time at work and honestly I often show a scatter plot without any lines and say here’s what the data is doing, you all decide whether it’s within bounds or not, and then for each specification we’re trying to match, we have established statistical analyses for determining limits and confidence intervals.
https://www.explainxkcd.com/wiki/index.php/2048:_Curve-Fitting
Check out Do it yourself line fit at https://www.geocities.ws/diylf/DIYLF.html
This is a tool for teaching linear regression