create Network and Training contracts

This commit is contained in:
Arkadiusz Kondas 2016-08-05 16:12:39 +02:00
parent 95b29d40b1
commit 12ee62bbca
5 changed files with 105 additions and 0 deletions

View File

@ -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;
}

View File

@ -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)
{
}
}

View File

@ -0,0 +1,10 @@
<?php
declare (strict_types = 1);
namespace Phpml\NeuralNetwork\Network;
class MultilayerPerceptron extends LayeredNetwork
{
}

View File

@ -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);
}

View File

@ -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)
{
}
}