MCordingley\Regression\StatisticsGatherer\Linear::getSumSquaredError PHP Method

getSumSquaredError() private method

Calculates the sum of the squares of the residuals, which are the distances of the observations from their predicted values, a raw measure of the overall error in the regression model.
private getSumSquaredError ( ) : float
return float
    private function getSumSquaredError() : float
    {
        if (is_null($this->sumSquaredError)) {
            $this->sumSquaredError = array_sum(array_map(function ($predicted, $observed) {
                return pow($predicted - $observed, 2);
            }, $this->getPredictedOutcomes(), $this->observations->getOutcomes()));
        }
        return $this->sumSquaredError;
    }