| 1 | <?php |
||
| 9 | class Synapse implements Node |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var float |
||
| 13 | */ |
||
| 14 | protected $weight; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var Node |
||
| 18 | */ |
||
| 19 | protected $node; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param Node $node |
||
| 23 | * @param float|null $weight |
||
| 24 | */ |
||
| 25 | public function __construct(Node $node, float $weight = null) |
||
| 30 | |||
| 31 | /** |
||
| 32 | * @return float |
||
| 33 | */ |
||
| 34 | protected function generateRandomWeight(): float |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @return float |
||
| 41 | */ |
||
| 42 | public function getOutput(): float |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param float $delta |
||
| 49 | */ |
||
| 50 | public function changeWeight($delta) |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return float |
||
| 57 | */ |
||
| 58 | public function getWeight() |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @return Node |
||
| 65 | */ |
||
| 66 | public function getNode() |
||
| 70 | } |
||
| 71 |