fitFromMany function

Tuple2<double, double> fitFromMany (Iterable<Tuple2<double, double>> samples)

Least-Squares fitting the points (x,y) to a line y : x -> a+b*x, returning its best fitting parameters as (a, b) tuple, where a is the intercept and b the slope.

Implementation

Tuple2<double, double> fitFromMany(Iterable<Tuple2<double, double>> samples) {
  var xy = unpackSinglePass(samples);
  return fit(xy.item1, xy.item2);
}