luminsports/linear-regression
最新稳定版本:1.3.1
Composer 安装命令:
composer require luminsports/linear-regression
包简介
Linear regression
README 文档
README
A Linear regression class that uses the least squares method to approximate a straight line to a data set. Forked from davebarnwell/ml-regression-least-squares, this version uses new PHP 8.1 syntax, and BCMath for high precision.
composer install luminsports/linear-regression
Usage:
$x = [...]; // target values $y = [...]; // observation values $linearRegression = new \LuminSports\LinearRegression\LeastSquares($x, $y); $slope = $linearRegression->getSlope(); $yIntercept = $linearRegression->getIntercept(); // return array of differences of y values from the regression line $differences = $linearRegression->getDifferencesFromRegressionLine(); // return array of cumulative sum of the differences of y values from the regression line $cumulativeSum = $linearRegression->getCumulativeSumOfDifferencesFromRegressionLine(); // return array of Point objects giving the x,y values of the regression line // for current data $regressionLine = $linearRegression->getRegressionLinePoints(); $regressionLine[0]->getX(); $regressionLine[0]->getY(); $predictedX = $linearRegression->predictX($anObservationValue); $predictedY = $linearRegression->predictY($aTargetValue); $rSquared = $linearRegression->getRSquared(); // Regression fit; 1 = perfect fit 0 = no fit
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-18