robotomize/regression-php

This package is abandoned and no longer maintained. No replacement package was suggested.

Calculates regression

v0.3.3 2017-08-30 22:41 UTC

README

Latest Stable Version Scrutinizer Code Quality Build Status Total Downloads License

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);