mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-18 20:04:28 +00:00
General cleanup and removal of all unnecessary references
This commit is contained in:
@ -13,7 +13,7 @@ class GaussianPriorFactor extends GaussianFactor
|
||||
{
|
||||
private $_newMessage;
|
||||
|
||||
public function __construct($mean, $variance, Variable &$variable)
|
||||
public function __construct($mean, $variance, Variable $variable)
|
||||
{
|
||||
parent::__construct(sprintf("Prior value going to %s", $variable));
|
||||
$this->_newMessage = new GaussianDistribution($mean, sqrt($variance));
|
||||
@ -23,18 +23,17 @@ class GaussianPriorFactor extends GaussianFactor
|
||||
$this->createVariableToMessageBindingWithMessage($variable, $newMessage);
|
||||
}
|
||||
|
||||
protected function updateMessageVariable(Message &$message, Variable &$variable)
|
||||
protected function updateMessageVariable(Message $message, Variable $variable)
|
||||
{
|
||||
$oldMarginal = clone $variable->getValue();
|
||||
$oldMessage = $message;
|
||||
$newMarginal =
|
||||
GaussianDistribution::fromPrecisionMean(
|
||||
$oldMarginal->getPrecisionMean() + $this->_newMessage->getPrecisionMean() - $oldMessage->getValue()->getPrecisionMean(),
|
||||
$oldMarginal->getPrecision() + $this->_newMessage->getPrecision() - $oldMessage->getValue()->getPrecision());
|
||||
$newMarginal = GaussianDistribution::fromPrecisionMean(
|
||||
$oldMarginal->getPrecisionMean() + $this->_newMessage->getPrecisionMean() - $oldMessage->getValue()->getPrecisionMean(),
|
||||
$oldMarginal->getPrecision() + $this->_newMessage->getPrecision() - $oldMessage->getValue()->getPrecision()
|
||||
);
|
||||
|
||||
$variable->setValue($newMarginal);
|
||||
$newMessage = &$this->_newMessage;
|
||||
$message->setValue($newMessage);
|
||||
$message->setValue($this->_newMessage);
|
||||
return GaussianDistribution::subtract($oldMarginal, $newMarginal);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user