mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2025-02-13 17:38:36 +00:00
29 lines
926 B
PHP
29 lines
926 B
PHP
|
<?php
|
||
|
|
||
|
declare(strict_types=1);
|
||
|
|
||
|
namespace tests\Phpml\NeuralNetwork\Network;
|
||
|
|
||
|
use Phpml\NeuralNetwork\Network\MultilayerPerceptron;
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
|
||
|
class MultilayerPerceptronTest extends TestCase
|
||
|
{
|
||
|
public function testLearningRateSetter(): void
|
||
|
{
|
||
|
$mlp = $this->getMockForAbstractClass(
|
||
|
MultilayerPerceptron::class,
|
||
|
[5, [3], [0, 1], 1000, null, 0.42]
|
||
|
);
|
||
|
|
||
|
$this->assertEquals(0.42, $this->readAttribute($mlp, 'learningRate'));
|
||
|
$backprop = $this->readAttribute($mlp, 'backpropagation');
|
||
|
$this->assertEquals(0.42, $this->readAttribute($backprop, 'learningRate'));
|
||
|
|
||
|
$mlp->setLearningRate(0.24);
|
||
|
$this->assertEquals(0.24, $this->readAttribute($mlp, 'learningRate'));
|
||
|
$backprop = $this->readAttribute($mlp, 'backpropagation');
|
||
|
$this->assertEquals(0.24, $this->readAttribute($backprop, 'learningRate'));
|
||
|
}
|
||
|
}
|