For a set of points, I want to get the straight line that is the closest approximation of the points using a least squares fit.
I can find a lot of overly complex solutions here on SO and elsewhere but I have not been able to find something simple. And this should be very simple.
var arr = new Point[] {{1,2}, {3,4}, {12, 9}};
Tuple<slope, intercept> = leastSquares(arr)
Is there some library function that implements the above leastSquares()?
CodePudding user response:
