robotomize / regression-php
Calculates regression
Installs: 31 068
Dependents: 0
Suggesters: 0
Security: 0
Stars: 16
Watchers: 4
Forks: 3
Open Issues: 0
Requires
- php: >=7.0
- nesbot/carbon: ^1.21
- paragonie/random_compat: ^2.0
Requires (Dev)
- phpmd/phpmd: 2.*
- phpunit/phpunit: ~4.0|~5.0
- squizlabs/php_codesniffer: 2.*
This package is not auto-updated.
Last update: 2023-03-18 10:36:29 UTC
README
Description
- Implementation of model building for regression
- New models of regression in the development
- There will be a separate thread for php 5.6
Requirements
- composer dependency (Carbon DateTime, random-bytes)
-
= PHP 7.0
Install
composer require robotomize/regression-php
Linear regression algorithm
Basic usage
$testData = [[0, 10], [1, 20], [2, 3], [3, 15], [4, 0]] $linear = new LinearRegression(); $linear->setSourceSequence($testData); $linear->calculate(); /** @var RegressionModel $regressionModel */ $regressionModel = $linear->getRegressionModel();
Factory usage
/** @var RegressionModel $regressionModel */ $regressionModel = Regression::Linear([[0, 10], [1, 20], [2, 3], [3, 15], [4, 0]]);
Exponential regression
Basic usage
$exponential = new ExponentialRegression(); $exponential->setSourceSequence($testData); $exponential->calculate(); $regressionModel = $exponential->getRegressionModel();
Factory usage
$regressionModel = Regression::Exponential($testData);
Logarithmic regression
Basic usage
$logarithmic = new LogarithmicRegression(); $logarithmic->setSourceSequence($testData); $logarithmic->calculate(); /** @var RegressionModel $regressionModel */ $regressionModel = $logarithmic->getRegressionModel();
Factory usage
$regressionModel = RegressionFactory::Logarithmic($testData);
Power regression
Basic usage
$powerReg = new PowerRegression(); $powerReg->setSourceSequence($testData); $powerReg->calculate(); /** @var RegressionModel $regressionModel */ $regressionModel = $powerReg->getRegressionModel();
Factory usage
$regressionModel = RegressionFactory::Power($testData);