Skip to content

Commit

Permalink
code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akondas committed Aug 14, 2016
1 parent f0bd5ae commit 638119f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Phpml/Regression/MLPRegressor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Phpml\Regression;


use Phpml\Helper\Predictable;
use Phpml\NeuralNetwork\ActivationFunction;
use Phpml\NeuralNetwork\Network\MultilayerPerceptron;
Expand Down Expand Up @@ -40,27 +39,28 @@ 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;
$this->maxIterations = $maxIterations;
$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);

Expand All @@ -77,5 +77,4 @@ protected function predictSample(array $sample)
{
return $this->perceptron->setInput($sample)->getOutput();
}

}

0 comments on commit 638119f

Please sign in to comment.