_teams = $teams; } public function buildLayer() { foreach ($this->_teams as $currentTeam) { $currentTeamSkills = array(); foreach ($currentTeam->getAllPlayers() as $currentTeamPlayer) { $currentTeamPlayerRating = $currentTeam->getRating($currentTeamPlayer); $playerSkill = $this->createSkillOutputVariable($currentTeamPlayer); $priorFactor = $this->createPriorFactor($currentTeamPlayer, $currentTeamPlayerRating, $playerSkill); $this->addLayerFactor($priorFactor); $currentTeamSkills[] = $playerSkill; } $outputVariablesGroups = &$this->getOutputVariablesGroups(); $outputVariablesGroups[] = $currentTeamSkills; } } public function createPriorSchedule() { return $this->scheduleSequence( array_map( function($prior) { return new ScheduleStep("Prior to Skill Step", $prior, 0); }, $this->getLocalFactors()), "All priors"); } private function createPriorFactor(&$player, &$priorRating, &$skillsVariable) { return new GaussianPriorFactor($priorRating->getMean(), square($priorRating->getStandardDeviation()) + square($this->getParentFactorGraph()->getGameInfo()->getDynamicsFactor()), $skillsVariable); } private function createSkillOutputVariable($key) { $parentFactorGraph = $this->getParentFactorGraph(); $variableFactory = $parentFactorGraph->getVariableFactory(); return $variableFactory->createKeyedVariable($key, $key . "'s skill"); } } ?>