public __construct ( array $points ) | ||
$points | array | [ [x, y], [x, y], ... ] |
public function __construct(array $points)
{
$this->points = $points;
$this->n = count($points);
// Get list of x points and y points.
// This will be fine for linear or polynomial regression, where there is only one x,
// but if expanding to multiple linear, the format will have to change.
$this->xs = array_map(function ($point) {
return $point[0];
}, $points);
$this->ys = array_map(function ($point) {
return $point[1];
}, $points);
}