Skip to content

Commit

Permalink
create Network and Training contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
akondas committed Aug 5, 2016
1 parent 95b29d4 commit 12ee62b
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Phpml/NeuralNetwork/Network.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare (strict_types = 1);

namespace Phpml\NeuralNetwork;

interface Network extends Node
{

/**
* @param mixed $input
*/
public function setInput($input);

/**
* @return array
*/
public function getLayers(): array;

}
36 changes: 36 additions & 0 deletions src/Phpml/NeuralNetwork/Network/LayeredNetwork.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare (strict_types = 1);

namespace Phpml\NeuralNetwork\Network;

use Phpml\NeuralNetwork\Network;

abstract class LayeredNetwork implements Network
{

/**
* @return array
*/
public function getLayers(): array
{

}

/**
* @return float
*/
public function getOutput(): float
{

}

/**
* @param mixed $input
*/
public function setInput($input)
{

}

}
10 changes: 10 additions & 0 deletions src/Phpml/NeuralNetwork/Network/MultilayerPerceptron.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare (strict_types = 1);

namespace Phpml\NeuralNetwork\Network;

class MultilayerPerceptron extends LayeredNetwork
{

}
16 changes: 16 additions & 0 deletions src/Phpml/NeuralNetwork/Training.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

declare (strict_types = 1);

namespace Phpml\NeuralNetwork;

interface Training
{
/**
* @param array $samples
* @param array $targets
* @param float $desiredError
* @param int $maxIterations
*/
public function train(array $samples, array $targets, float $desiredError = 0.001, int $maxIterations = 10000);
}
23 changes: 23 additions & 0 deletions src/Phpml/NeuralNetwork/Training/Backpropagation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

declare (strict_types = 1);

namespace Phpml\NeuralNetwork\Training;

use Phpml\NeuralNetwork\Training;

class Backpropagation implements Training
{

/**
* @param array $samples
* @param array $targets
* @param float $desiredError
* @param int $maxIterations
*/
public function train(array $samples, array $targets, float $desiredError = 0.001, int $maxIterations = 10000)
{

}

}

0 comments on commit 12ee62b

Please sign in to comment.