mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-16 18:25:12 +00:00
better arguments format for regression
This commit is contained in:
parent
ff79de7e14
commit
ff9adc267c
@ -35,6 +35,20 @@ class LeastSquaresTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(278.66, $regression->predict([153260]), '', $delta);
|
$this->assertEquals(278.66, $regression->predict([153260]), '', $delta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testPredictSingleFeatureSamplesWithMatrixTargets()
|
||||||
|
{
|
||||||
|
$delta = 0.01;
|
||||||
|
|
||||||
|
//https://www.easycalculation.com/analytical/learn-least-square-regression.php
|
||||||
|
$samples = [[60], [61], [62], [63], [65]];
|
||||||
|
$targets = [[3.1], [3.6], [3.8], [4], [4.1]];
|
||||||
|
|
||||||
|
$regression = new LeastSquares();
|
||||||
|
$regression->train($samples, $targets);
|
||||||
|
|
||||||
|
$this->assertEquals(4.06, $regression->predict([64]), '', $delta);
|
||||||
|
}
|
||||||
|
|
||||||
public function testPredictMultiFeaturesSamples()
|
public function testPredictMultiFeaturesSamples()
|
||||||
{
|
{
|
||||||
$delta = 0.01;
|
$delta = 0.01;
|
||||||
|
Loading…
Reference in New Issue
Block a user