/** * @param Neuron $from * @throws \Exception */ public function send(Neuron $from) { //Choose @var int $_directionType $_directionType = Net::getDirection() == Net::DIRECT ? self::HIGHER_NEURON : self::LOWER_NEURON; if (!isset($this->_neurons[$_directionType])) { throw new \Exception("Something wrong is with direction ({$_directionType}) or relation wasn`t init."); } /** @var Neuron $to */ $to = $this->_neurons[$_directionType]; //var_dump("Value: " . $from->getValue() . " Class: " . get_class($from)); $to->addSignal($this->_weight * $from->getValue()); // If we are on mistake step we need to correct weights if (Net::isMistakeFlow()) { $this->_weightCorrection($to, $from); } }