Phpml\Regression\LeastSquares::computeCoefficients PHP Метод

computeCoefficients() приватный Метод

coefficient(b) = (X'X)-1X'Y.
private computeCoefficients ( )
    private function computeCoefficients()
    {
        $samplesMatrix = $this->getSamplesMatrix();
        $targetsMatrix = $this->getTargetsMatrix();
        $ts = $samplesMatrix->transpose()->multiply($samplesMatrix)->inverse();
        $tf = $samplesMatrix->transpose()->multiply($targetsMatrix);
        $this->coefficients = $ts->multiply($tf)->getColumnValues(0);
        $this->intercept = array_shift($this->coefficients);
    }