本文整理汇总了Python中skills.numerics.Gaussian.log_product_normalization方法的典型用法代码示例。如果您正苦于以下问题:Python Gaussian.log_product_normalization方法的具体用法?Python Gaussian.log_product_normalization怎么用?Python Gaussian.log_product_normalization使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类skills.numerics.Gaussian
的用法示例。
在下文中一共展示了Gaussian.log_product_normalization方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testLogProductNormalization
# 需要导入模块: from skills.numerics import Gaussian [as 别名]
# 或者: from skills.numerics.Gaussian import log_product_normalization [as 别名]
def testLogProductNormalization(self):
standard_normal = Gaussian(0, 1)
lpn = Gaussian.log_product_normalization(standard_normal, standard_normal)
answer = -1.2655121234846454
self.assertAlmostEqual(answer, lpn, None,
"testLogProductNormalization lpn expected %.15f, got %.15f" % (answer, lpn),
GaussianDistributionTest.ERROR_TOLERANCE)
m1s2 = Gaussian(1.0, 2.0)
m3s4 = Gaussian(3.0, 4.0)
lpn2 = Gaussian.log_product_normalization(m1s2, m3s4)
answer = -2.5168046699816684
self.assertAlmostEqual(answer, lpn2, None,
"testLogProductNormalization lpn2 expected %.15f, got %.15f" % (answer, lpn2),
GaussianDistributionTest.ERROR_TOLERANCE)
示例2: log_normalization
# 需要导入模块: from skills.numerics import Gaussian [as 别名]
# 或者: from skills.numerics.Gaussian import log_product_normalization [as 别名]
def log_normalization(self):
marginal = self.variables[0].value
message = self.messages[0].value
message_from_variable = marginal / message
return (-Gaussian.log_product_normalization(message_from_variable, message) +
log(Gaussian.cumulative_to((message_from_variable.mean - self.epsilon) / message_from_variable.stdev)))
示例3: send_message_variable
# 需要导入模块: from skills.numerics import Gaussian [as 别名]
# 或者: from skills.numerics.Gaussian import log_product_normalization [as 别名]
def send_message_variable(self, message, variable):
marginal = variable.value
message_value = message.value
log_z = Gaussian.log_product_normalization(marginal, message_value)
variable.value = marginal * message_value
return log_z