xs); $y’ = array_map('log', $this->ys); // Perform Least Squares Fit $linearized_parameters = $this->leastSquares($y’, $x’)->getColumn(0); // Translate the linearized parameters back. $this->a = exp($linearized_parameters[0]); $this->b = $linearized_parameters[1]; $this->parameters = [$this->a, $this->b]; } /** * Evaluate the regression equation at x * Uses the instance model's evaluateModel method. * * @param float $x * * @return float */ public function evaluate(float $x): float { return $this->evaluateModel($x, $this->parameters); } }