mirror of
https://github.com/Llewellynvdm/php-ml.git
synced 2024-11-24 22:07:33 +00:00
code style fixes
This commit is contained in:
parent
f0bd5ae424
commit
638119fc98
@ -4,7 +4,6 @@ declare (strict_types = 1);
|
||||
|
||||
namespace Phpml\Regression;
|
||||
|
||||
|
||||
use Phpml\Helper\Predictable;
|
||||
use Phpml\NeuralNetwork\ActivationFunction;
|
||||
use Phpml\NeuralNetwork\Network\MultilayerPerceptron;
|
||||
@ -40,12 +39,12 @@ class MLPRegressor implements Regression
|
||||
private $activationFunction;
|
||||
|
||||
/**
|
||||
* @param array $hiddenLayers
|
||||
* @param float $desiredError
|
||||
* @param int $maxIterations
|
||||
* @param array $hiddenLayers
|
||||
* @param float $desiredError
|
||||
* @param int $maxIterations
|
||||
* @param ActivationFunction $activationFunction
|
||||
*/
|
||||
public function __construct(array $hiddenLayers = [100], float $desiredError, int $maxIterations, ActivationFunction $activationFunction = null)
|
||||
public function __construct(array $hiddenLayers = [10], float $desiredError = 0.01, int $maxIterations = 10000, ActivationFunction $activationFunction = null)
|
||||
{
|
||||
$this->hiddenLayers = $hiddenLayers;
|
||||
$this->desiredError = $desiredError;
|
||||
@ -53,14 +52,15 @@ class MLPRegressor implements Regression
|
||||
$this->activationFunction = $activationFunction;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $samples
|
||||
* @param array $targets
|
||||
*/
|
||||
public function train(array $samples, array $targets)
|
||||
{
|
||||
$layers = [count($samples[0])] + $this->hiddenLayers + [count($targets[0])];
|
||||
$layers = $this->hiddenLayers;
|
||||
array_unshift($layers, count($samples[0]));
|
||||
$layers[] = count($targets[0]);
|
||||
|
||||
$this->perceptron = new MultilayerPerceptron($layers, $this->activationFunction);
|
||||
|
||||
@ -77,5 +77,4 @@ class MLPRegressor implements Regression
|
||||
{
|
||||
return $this->perceptron->setInput($sample)->getOutput();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user