From 196d09429af05b70a99cca303512d9d15416d625 Mon Sep 17 00:00:00 2001 From: Jeff Moser Date: Mon, 27 Sep 2010 22:26:28 -0400 Subject: [PATCH] More debugging name cleanups along with a few reference tweaks. Next up: fixing the schedule and running it --- PHPSkills/FactorGraphs/Factor.php | 2 +- PHPSkills/FactorGraphs/FactorGraphLayer.php | 4 ++-- PHPSkills/Numerics/GaussianDistribution.php | 2 +- PHPSkills/Rating.php | 2 +- .../TrueSkill/Layers/IteratedTeamDifferencesInnerLayer.php | 2 +- .../Layers/PlayerPerformancesToTeamPerformancesLayer.php | 2 +- .../TrueSkill/Layers/PlayerSkillsToPerformancesLayer.php | 4 ++-- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/PHPSkills/FactorGraphs/Factor.php b/PHPSkills/FactorGraphs/Factor.php index bbb64fc..384c43e 100644 --- a/PHPSkills/FactorGraphs/Factor.php +++ b/PHPSkills/FactorGraphs/Factor.php @@ -85,7 +85,7 @@ abstract class Factor $index = count($this->_messages); $this->_messages[] = $message; $this->_messageToVariableBinding->setValue($message, $variable); - $this->_variables[] = &$variable; + $this->_variables[] = $variable; return $message; } diff --git a/PHPSkills/FactorGraphs/FactorGraphLayer.php b/PHPSkills/FactorGraphs/FactorGraphLayer.php index 7d025ad..0a80ef7 100644 --- a/PHPSkills/FactorGraphs/FactorGraphLayer.php +++ b/PHPSkills/FactorGraphs/FactorGraphLayer.php @@ -43,9 +43,9 @@ abstract class FactorGraphLayer $this->_inputVariablesGroups = $value; } - protected function scheduleSequence(&$itemsToSequence) + protected function scheduleSequence(&$itemsToSequence, $name) { - return new ScheduleSequence("TODO", $itemsToSequence); + return new ScheduleSequence($name, $itemsToSequence); } protected function addLayerFactor(&$factor) diff --git a/PHPSkills/Numerics/GaussianDistribution.php b/PHPSkills/Numerics/GaussianDistribution.php index ff0c95d..6c0dacb 100644 --- a/PHPSkills/Numerics/GaussianDistribution.php +++ b/PHPSkills/Numerics/GaussianDistribution.php @@ -261,7 +261,7 @@ class GaussianDistribution public function __toString() { - return 'mean=' . $this->_mean . ' standardDeviation=' . $this->_standardDeviation; + return sprintf("mean=%.4f standardDeviation=%.4f", $this->_mean, $this->_standardDeviation); } } ?> \ No newline at end of file diff --git a/PHPSkills/Rating.php b/PHPSkills/Rating.php index 75114b8..99f1791 100644 --- a/PHPSkills/Rating.php +++ b/PHPSkills/Rating.php @@ -72,7 +72,7 @@ class Rating public function __toString() { - return 'mean=' . $this->_mean . ' standardDeviation=' . $this->_standardDeviation; + return sprintf("mean=%.4f, standardDeviation=%.4f", $this->_mean, $this->_standardDeviation); } } diff --git a/PHPSkills/TrueSkill/Layers/IteratedTeamDifferencesInnerLayer.php b/PHPSkills/TrueSkill/Layers/IteratedTeamDifferencesInnerLayer.php index 9a26388..40ec599 100644 --- a/PHPSkills/TrueSkill/Layers/IteratedTeamDifferencesInnerLayer.php +++ b/PHPSkills/TrueSkill/Layers/IteratedTeamDifferencesInnerLayer.php @@ -67,7 +67,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer "teamPerformanceToPerformanceDifferenceFactors[0] @ 1", $localFactors[0], 1), new ScheduleStep( - "teamPerformanceToPerformanceDifferenceFactors[teamTeamDifferences = {0} - 1] @ 2", + sprintf("teamPerformanceToPerformanceDifferenceFactors[teamTeamDifferences = %d - 1] @ 2", $totalTeamDifferences), $localFactors[$totalTeamDifferences - 1], 2) ) ); diff --git a/PHPSkills/TrueSkill/Layers/PlayerPerformancesToTeamPerformancesLayer.php b/PHPSkills/TrueSkill/Layers/PlayerPerformancesToTeamPerformancesLayer.php index f31dbbd..71080fc 100644 --- a/PHPSkills/TrueSkill/Layers/PlayerPerformancesToTeamPerformancesLayer.php +++ b/PHPSkills/TrueSkill/Layers/PlayerPerformancesToTeamPerformancesLayer.php @@ -74,7 +74,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye $numberOfMessages = $currentFactor->getNumberOfMessages(); for($currentIteration = 1; $currentIteration < $numberOfMessages; $currentIteration++) { - $allFactors[] = new ScheduleStep("team sum perf @" + $currentIteration, + $allFactors[] = new ScheduleStep("team sum perf @" . $currentIteration, $currentFactor, $currentIteration); } } diff --git a/PHPSkills/TrueSkill/Layers/PlayerSkillsToPerformancesLayer.php b/PHPSkills/TrueSkill/Layers/PlayerSkillsToPerformancesLayer.php index 65dd08e..4478616 100644 --- a/PHPSkills/TrueSkill/Layers/PlayerSkillsToPerformancesLayer.php +++ b/PHPSkills/TrueSkill/Layers/PlayerSkillsToPerformancesLayer.php @@ -29,11 +29,11 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer $playerPerformance = $this->createOutputVariable($playerSkillVariable->getKey()); $newLikelihoodFactor = $this->createLikelihood($playerSkillVariable, $playerPerformance); $this->addLayerFactor($newLikelihoodFactor); - $currentTeamPlayerPerformances[] = &$playerPerformance; + $currentTeamPlayerPerformances[] = $playerPerformance; } $outputVariablesGroups = &$this->getOutputVariablesGroups(); - $outputVariablesGroups[] = &$currentTeamPlayerPerformances; + $outputVariablesGroups[] = $currentTeamPlayerPerformances; } }