1 | <?php |
||
12 | class Neuron implements Node |
||
13 | { |
||
14 | /** |
||
15 | * @var Synapse[] |
||
16 | */ |
||
17 | protected $synapses = []; |
||
18 | |||
19 | /** |
||
20 | * @var ActivationFunction |
||
21 | */ |
||
22 | protected $activationFunction; |
||
23 | |||
24 | /** |
||
25 | * @var float |
||
26 | */ |
||
27 | protected $output = 0.0; |
||
28 | |||
29 | /** |
||
30 | * @var float |
||
31 | */ |
||
32 | protected $z = 0.0; |
||
33 | |||
34 | public function __construct(?ActivationFunction $activationFunction = null) |
||
38 | |||
39 | public function addSynapse(Synapse $synapse): void |
||
43 | |||
44 | /** |
||
45 | * @return Synapse[] |
||
46 | */ |
||
47 | public function getSynapses() |
||
51 | |||
52 | public function getOutput(): float |
||
65 | |||
66 | public function getDerivative(): float |
||
70 | |||
71 | public function reset(): void |
||
76 | } |
||
77 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.