| 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; |
||
| 28 | |||
| 29 | public function __construct(?ActivationFunction $activationFunction = null) |
||
| 35 | |||
| 36 | public function addSynapse(Synapse $synapse): void |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return Synapse[] |
||
| 43 | */ |
||
| 44 | public function getSynapses() |
||
| 48 | |||
| 49 | public function getOutput(): float |
||
| 62 | |||
| 63 | public function getDerivative(float $value): float |
||
| 67 | |||
| 68 | public function reset(): void |
||
| 72 | } |
||
| 73 |
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.