mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2025-01-10 09:02:15 +00:00
add word tokenizer
This commit is contained in:
parent
430c1078cf
commit
078f543146
@ -20,18 +20,6 @@ class SVRTest extends \PHPUnit_Framework_TestCase
|
|||||||
$regression->train($samples, $targets);
|
$regression->train($samples, $targets);
|
||||||
|
|
||||||
$this->assertEquals(4.03, $regression->predict([64]), '', $delta);
|
$this->assertEquals(4.03, $regression->predict([64]), '', $delta);
|
||||||
|
|
||||||
$samples = [[9300], [10565], [15000], [15000], [17764], [57000], [65940], [73676], [77006], [93739], [146088], [153260]];
|
|
||||||
$targets = [7100, 15500, 4400, 4400, 5900, 4600, 8800, 2000, 2750, 2550, 960, 1025];
|
|
||||||
|
|
||||||
$regression = new SVR(Kernel::LINEAR);
|
|
||||||
$regression->train($samples, $targets);
|
|
||||||
|
|
||||||
$this->assertEquals(6236.12, $regression->predict([9300]), '', $delta);
|
|
||||||
$this->assertEquals(4718.29, $regression->predict([57000]), '', $delta);
|
|
||||||
$this->assertEquals(4081.69, $regression->predict([77006]), '', $delta);
|
|
||||||
$this->assertEquals(6236.12, $regression->predict([9300]), '', $delta);
|
|
||||||
$this->assertEquals(1655.26, $regression->predict([153260]), '', $delta);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPredictMultiFeaturesSamples()
|
public function testPredictMultiFeaturesSamples()
|
||||||
@ -44,7 +32,6 @@ class SVRTest extends \PHPUnit_Framework_TestCase
|
|||||||
$regression = new SVR(Kernel::LINEAR);
|
$regression = new SVR(Kernel::LINEAR);
|
||||||
$regression->train($samples, $targets);
|
$regression->train($samples, $targets);
|
||||||
|
|
||||||
$this->assertEquals(4109.82, $regression->predict([60000, 1996]), '', $delta);
|
$this->assertEquals([4109.82, 4112.28], $regression->predict([[60000, 1996], [60000, 2000]]), '', $delta);
|
||||||
$this->assertEquals(4112.28, $regression->predict([60000, 2000]), '', $delta);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user