/** * @param \Sereban\NeuronNet\App $app * @param array $_values */ public function initCounts(App $app, array $_values) { $initCount = count($_values[Layout\Collection::INITIAL_VALUES][0]); $teacherCount = count($_values[Layout\Collection::TEACHER_VALUES][0]); $assocCount = (int) ($initCount * NeuronNet\Relation::ACCELERATOR); //The number of associated neurons should be smaller than the number of stimulated //Setting counts $app->setNeuronCount(NeuronNet\Factory::STIM, $initCount); $app->setNeuronCount(NeuronNet\Factory::ASSOC, $assocCount); $app->setNeuronCount(NeuronNet\Factory::REACT, $teacherCount); }
/** * Full Test: check whether back propagation was successful * @throws \Exception */ public function testAbsolute() { $_values = $this->parseYaml($this->_getCurrentFolder(__DIR__, "absolute", "absolute.yml")); $_values = $this->prepareValues($_values); $this->initCounts($this->_app, $_values); //Initializing and start $this->_app->init($_values); $this->_app->start(); Net::setMode(Net::PRODUCTION_MODE); $this->_app->start(); //run app with same values but in production mode $lastLayout = $this->_app->getLayoutCollection()->getLastLayout(); /** @var NeuronNet\Neuron\React $winner */ $winner = $lastLayout->seek($this->_app->getWinner()); //Compare standard teacher value with winner`s teacher value $this->assertEquals(self::WINNER_TEACHER_VALUE, $winner->getTeacherValue()); }