_newMessage = new GaussianDistribution($mean, sqrt($variance)); $newMessage = new Message(GaussianDistribution::fromPrecisionMean(0, 0), sprintf("message from %s to %s", $this, $variable)); $this->createVariableToMessageBindingWithMessage($variable, $newMessage); } 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()); $variable->setValue($newMarginal); $newMessage = &$this->_newMessage; $message->setValue($newMessage); return GaussianDistribution::subtract($oldMarginal, $newMarginal); } } ?>