mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-21 20:45:10 +00:00
Fix backpropagation random error (#157)
This commit is contained in:
parent
ff80af2044
commit
333598b472
@ -112,16 +112,16 @@ class MLPClassifierTest extends TestCase
|
||||
public function testBackpropagationLearningMultilayer(): void
|
||||
{
|
||||
// Multi-layer 2 classes.
|
||||
$network = new MLPClassifier(5, [3, 2], ['a', 'b']);
|
||||
$network = new MLPClassifier(5, [3, 2], ['a', 'b', 'c']);
|
||||
$network->train(
|
||||
[[1, 0, 0, 0, 0], [0, 1, 1, 0, 0], [1, 1, 1, 1, 1], [0, 0, 0, 0, 0]],
|
||||
['a', 'b', 'a', 'b']
|
||||
['a', 'b', 'a', 'c']
|
||||
);
|
||||
|
||||
$this->assertEquals('a', $network->predict([1, 0, 0, 0, 0]));
|
||||
$this->assertEquals('b', $network->predict([0, 1, 1, 0, 0]));
|
||||
$this->assertEquals('a', $network->predict([1, 1, 1, 1, 1]));
|
||||
$this->assertEquals('b', $network->predict([0, 0, 0, 0, 0]));
|
||||
$this->assertEquals('c', $network->predict([0, 0, 0, 0, 0]));
|
||||
}
|
||||
|
||||
public function testBackpropagationLearningMulticlass(): void
|
||||
|
Loading…
Reference in New Issue
Block a user