mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-16 01:47:39 +00:00
Removed some debugging code
This commit is contained in:
@ -35,14 +35,12 @@ abstract class Factor
|
|||||||
return count($this->_messages);
|
return count($this->_messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEBUG: make protected
|
protected function &getVariables()
|
||||||
public function &getVariables()
|
|
||||||
{
|
{
|
||||||
return $this->_variables;
|
return $this->_variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEBUG: make protected
|
protected function &getMessages()
|
||||||
public function &getMessages()
|
|
||||||
{
|
{
|
||||||
return $this->_messages;
|
return $this->_messages;
|
||||||
}
|
}
|
||||||
@ -53,11 +51,6 @@ abstract class Factor
|
|||||||
Guard::argumentIsValidIndex($messageIndex, count($this->_messages), "messageIndex");
|
Guard::argumentIsValidIndex($messageIndex, count($this->_messages), "messageIndex");
|
||||||
$message = &$this->_messages[$messageIndex];
|
$message = &$this->_messages[$messageIndex];
|
||||||
$variable = &$this->_messageToVariableBinding->getValue($message);
|
$variable = &$this->_messageToVariableBinding->getValue($message);
|
||||||
// DEBUG
|
|
||||||
$selfName = (string)$this;
|
|
||||||
$debugName = (string)$variable;
|
|
||||||
$debugHash = \spl_object_hash($variable);
|
|
||||||
$debugValue = $variable->getValue();
|
|
||||||
return $this->updateMessageVariable($message, $variable);
|
return $this->updateMessageVariable($message, $variable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@ class Message
|
|||||||
|
|
||||||
public function setValue(&$value)
|
public function setValue(&$value)
|
||||||
{
|
{
|
||||||
// DEBUG
|
|
||||||
$selfName = (string)$this;
|
|
||||||
$this->_value = &$value;
|
$this->_value = &$value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,6 @@ class ScheduleStep extends Schedule
|
|||||||
public function visit($depth = -1, $maxDepth = 0)
|
public function visit($depth = -1, $maxDepth = 0)
|
||||||
{
|
{
|
||||||
$currentFactor = &$this->_factor;
|
$currentFactor = &$this->_factor;
|
||||||
// DEBUG
|
|
||||||
$currentFactorName = (string)$currentFactor;
|
|
||||||
$delta = $currentFactor->updateMessageIndex($this->_index);
|
$delta = $currentFactor->updateMessageIndex($this->_index);
|
||||||
return $delta;
|
return $delta;
|
||||||
}
|
}
|
||||||
|
@ -17,17 +17,11 @@ class Variable
|
|||||||
public function &getValue()
|
public function &getValue()
|
||||||
{
|
{
|
||||||
$value = &$this->_value;
|
$value = &$this->_value;
|
||||||
// DEBUG
|
|
||||||
$selfHash = \spl_object_hash($this);
|
|
||||||
$selfName = (string)$this;
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setValue(&$value)
|
public function setValue(&$value)
|
||||||
{
|
{
|
||||||
// DEBUG
|
|
||||||
$selfName = (string)$this;
|
|
||||||
$selfHash = \spl_object_hash($this);
|
|
||||||
$this->_value = &$value;
|
$this->_value = &$value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,12 +39,6 @@ class GaussianLikelihoodFactor extends GaussianFactor
|
|||||||
private function updateHelper(Message &$message1, Message &$message2,
|
private function updateHelper(Message &$message1, Message &$message2,
|
||||||
Variable &$variable1, Variable &$variable2)
|
Variable &$variable1, Variable &$variable2)
|
||||||
{
|
{
|
||||||
// DEBUG
|
|
||||||
$message1ValueTest = $message1->getValue();
|
|
||||||
$variable1ValueTest = $variable1->getValue();
|
|
||||||
$message2ValueTest = $message2->getValue();
|
|
||||||
$variable2ValueTest = $variable2->getValue();
|
|
||||||
|
|
||||||
$message1Value = clone $message1->getValue();
|
$message1Value = clone $message1->getValue();
|
||||||
$message2Value = clone $message2->getValue();
|
$message2Value = clone $message2->getValue();
|
||||||
|
|
||||||
|
@ -122,10 +122,6 @@ class GaussianWeightedSumFactor extends GaussianFactor
|
|||||||
$localCurrentVariable = &$currentVariable;
|
$localCurrentVariable = &$currentVariable;
|
||||||
$this->createVariableToMessageBinding($localCurrentVariable);
|
$this->createVariableToMessageBinding($localCurrentVariable);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEBUG
|
|
||||||
$selfName = (string)$this;
|
|
||||||
$selfVars = &$this->getVariables();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLogNormalization()
|
public function getLogNormalization()
|
||||||
@ -205,8 +201,6 @@ class GaussianWeightedSumFactor extends GaussianFactor
|
|||||||
|
|
||||||
public function updateMessageIndex($messageIndex)
|
public function updateMessageIndex($messageIndex)
|
||||||
{
|
{
|
||||||
// DEBUG
|
|
||||||
$currentFactorName = (string)$this;
|
|
||||||
$allMessages = &$this->getMessages();
|
$allMessages = &$this->getMessages();
|
||||||
$allVariables = &$this->getVariables();
|
$allVariables = &$this->getVariables();
|
||||||
|
|
||||||
@ -227,12 +221,6 @@ class GaussianWeightedSumFactor extends GaussianFactor
|
|||||||
$updatedVariables[] = &$allVariables[$indicesToUse[$i]];
|
$updatedVariables[] = &$allVariables[$indicesToUse[$i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEBUG
|
|
||||||
foreach($allVariables as &$currentVariable)
|
|
||||||
{
|
|
||||||
$currentVarVal = &$currentVariable->getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->updateHelper($this->_weights[$messageIndex],
|
return $this->updateHelper($this->_weights[$messageIndex],
|
||||||
$this->_weightsSquared[$messageIndex],
|
$this->_weightsSquared[$messageIndex],
|
||||||
$updatedMessages,
|
$updatedMessages,
|
||||||
|
@ -145,7 +145,6 @@ class TrueSkillFactorGraph extends FactorGraph
|
|||||||
foreach ($currentTeam as &$currentPlayer)
|
foreach ($currentTeam as &$currentPlayer)
|
||||||
{
|
{
|
||||||
$localCurrentPlayer = &$currentPlayer->getKey();
|
$localCurrentPlayer = &$currentPlayer->getKey();
|
||||||
$test = \spl_object_hash($localCurrentPlayer);
|
|
||||||
$newRating = new Rating($currentPlayer->getValue()->getMean(),
|
$newRating = new Rating($currentPlayer->getValue()->getMean(),
|
||||||
$currentPlayer->getValue()->getStandardDeviation());
|
$currentPlayer->getValue()->getStandardDeviation());
|
||||||
|
|
||||||
|
@ -82,8 +82,6 @@ class TrueSkillCalculatorTests
|
|||||||
{
|
{
|
||||||
$player1 = new Player(1);
|
$player1 = new Player(1);
|
||||||
$player2 = new Player(2);
|
$player2 = new Player(2);
|
||||||
$p1Key = \spl_object_hash($player1);
|
|
||||||
$p2Key = \spl_object_hash($player2);
|
|
||||||
$gameInfo = new GameInfo();
|
$gameInfo = new GameInfo();
|
||||||
|
|
||||||
$team1 = new Team($player1, $gameInfo->getDefaultRating());
|
$team1 = new Team($player1, $gameInfo->getDefaultRating());
|
||||||
@ -200,6 +198,10 @@ class TrueSkillCalculatorTests
|
|||||||
self::assertMatchQuality($testClass, 0.135, $calculator->calculateMatchQuality($gameInfo, $teams));
|
self::assertMatchQuality($testClass, 0.135, $calculator->calculateMatchQuality($gameInfo, $teams));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// Two Team Tests
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
private static function twoOnTwoSimpleTest($testClass, SkillCalculator $calculator)
|
private static function twoOnTwoSimpleTest($testClass, SkillCalculator $calculator)
|
||||||
{
|
{
|
||||||
$player1 = new Player(1);
|
$player1 = new Player(1);
|
||||||
@ -586,6 +588,7 @@ class TrueSkillCalculatorTests
|
|||||||
self::assertMatchQuality($testClass, 0.447, $calculator->calculateMatchQuality($gameInfo, $teams));
|
self::assertMatchQuality($testClass, 0.447, $calculator->calculateMatchQuality($gameInfo, $teams));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function threeTeamsOfOneNotDrawn($testClass, SkillCalculator $calculator)
|
private static function threeTeamsOfOneNotDrawn($testClass, SkillCalculator $calculator)
|
||||||
{
|
{
|
||||||
$player1 = new Player(1);
|
$player1 = new Player(1);
|
||||||
|
Reference in New Issue
Block a user