Reputation: 11
I wanted to use excel function (REGLINW) in php code to calculate extrapolated.
I tried to use the LeastSquares function (https://php-ml.readthedocs.io/en/latest/machine-learning/regression/least-squares/ ), but the results are a bit different due to the fact that the excel function includes dates. Can anyone recommend how to get the same results as in the excel function?
My code:
$x[] = [$extrapolatedPeriod];
$y[] = [$extrapolatedData['billable_connections'] ?? 0];
$regression = new LeastSquares();
$regression->train($x, $y);
$extrapolatedResults[$extrapolatedPeriod] = intval($regression->predict([$numbersOfPeriod]));
Upvotes: 1
Views: 32