Total Complexity | 7 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | class Synapse |
||
10 | { |
||
11 | /** |
||
12 | * @var float |
||
13 | */ |
||
14 | protected $weight; |
||
15 | |||
16 | /** |
||
17 | * @var Node |
||
18 | */ |
||
19 | protected $node; |
||
20 | |||
21 | /** |
||
22 | * @param float|null $weight |
||
23 | */ |
||
24 | public function __construct(Node $node, ?float $weight = null) |
||
25 | { |
||
26 | $this->node = $node; |
||
27 | $this->weight = $weight ?? $this->generateRandomWeight(); |
||
28 | } |
||
29 | |||
30 | public function getOutput(): float |
||
33 | } |
||
34 | |||
35 | public function changeWeight(float $delta): void |
||
36 | { |
||
37 | $this->weight += $delta; |
||
38 | } |
||
39 | |||
40 | public function getWeight(): float |
||
43 | } |
||
44 | |||
45 | public function getNode(): Node |
||
48 | } |
||
49 | |||
50 | protected function generateRandomWeight(): float |
||
53 | } |
||
54 | } |
||
55 |