forked from jorgecasas/php-ml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create Network and Training contracts
- Loading branch information
Showing
5 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
{ | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
{ | ||
|
||
} | ||
|
||
} |