MathPHP\Statistics\Regression\Regression::__construct PHP Метод

__construct() публичный Метод

Constructor - Prepares the data arrays for regression analysis
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);
    }