mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-22 21:15:10 +00:00
6660645ecd
* composer: update dev dependencies * phpstan fixes * phpstan fixes * phpstan fixes * phpstan fixes * drop probably forgotten humbug configs * apply cs * fix cs bug * compsoer: add coding standard and phsptan dev friendly scripts * ecs: add skipped errors * cs: fix PHP 7.1 * fix cs * ecs: exclude strict fixer that break code * ecs: cleanup commented sets * travis: use composer scripts for testing to prevent duplicated setup
30 lines
972 B
PHP
30 lines
972 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Phpml\Tests\NeuralNetwork\Network;
|
|
|
|
use Phpml\NeuralNetwork\Network\MultilayerPerceptron;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class MultilayerPerceptronTest extends TestCase
|
|
{
|
|
public function testLearningRateSetter(): void
|
|
{
|
|
/** @var MultilayerPerceptron $mlp */
|
|
$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'));
|
|
}
|
|
}
|