本文整理汇总了Python中dit.Distribution.is_approx_equal方法的典型用法代码示例。如果您正苦于以下问题:Python Distribution.is_approx_equal方法的具体用法?Python Distribution.is_approx_equal怎么用?Python Distribution.is_approx_equal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dit.Distribution
的用法示例。
在下文中一共展示了Distribution.is_approx_equal方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_init11
# 需要导入模块: from dit import Distribution [as 别名]
# 或者: from dit.Distribution import is_approx_equal [as 别名]
def test_init11():
outcomes = ["0", "1"]
pmf = [1 / 2, 1 / 2]
d = Distribution(outcomes, pmf)
sd = ScalarDistribution.from_distribution(d)
# Different sample space representations
assert_false(d.is_approx_equal(sd))
示例2: test_pr_1
# 需要导入模块: from dit import Distribution [as 别名]
# 或者: from dit.Distribution import is_approx_equal [as 别名]
def test_pr_1():
"""
Test
"""
d1 = Distribution(list(product([0, 1], repeat=4)), [1/16]*16)
d2 = pr_box(0.0)
assert d1.is_approx_equal(d2)
示例3: test_init12
# 需要导入模块: from dit import Distribution [as 别名]
# 或者: from dit.Distribution import is_approx_equal [as 别名]
def test_init12():
outcomes = ['0', '1']
pmf = [1/2, 1/2]
d = Distribution(outcomes, pmf)
sd = ScalarDistribution.from_distribution(d, base=10)
d.set_base(10)
# Different sample space representations
assert_false(d.is_approx_equal(sd))
示例4: test_pr_2
# 需要导入模块: from dit import Distribution [as 别名]
# 或者: from dit.Distribution import is_approx_equal [as 别名]
def test_pr_2():
"""
Test
"""
d1 = Distribution([(0, 0, 0, 0),
(0, 0, 1, 1),
(0, 1, 0, 0),
(0, 1, 1, 1),
(1, 0, 0, 0),
(1, 0, 1, 1),
(1, 1, 0, 1),
(1, 1, 1, 0)], [1/8]*8)
d2 = pr_box(1.0, name=True)
assert d1.is_approx_equal(d2)