本文整理匯總了Python中dit.ScalarDistribution.make_dense方法的典型用法代碼示例。如果您正苦於以下問題:Python ScalarDistribution.make_dense方法的具體用法?Python ScalarDistribution.make_dense怎麽用?Python ScalarDistribution.make_dense使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dit.ScalarDistribution
的用法示例。
在下文中一共展示了ScalarDistribution.make_dense方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_disequilibrium6
# 需要導入模塊: from dit import ScalarDistribution [as 別名]
# 或者: from dit.ScalarDistribution import make_dense [as 別名]
def test_disequilibrium6(n):
"""
Test that peaked Distributions have non-zero disequilibrium.
"""
d = ScalarDistribution([1] + [0]*(n-1))
d.make_dense()
d = Distribution.from_distribution(d)
assert disequilibrium(d) >= 0
示例2: test_LMPR_complexity5
# 需要導入模塊: from dit import ScalarDistribution [as 別名]
# 或者: from dit.ScalarDistribution import make_dense [as 別名]
def test_LMPR_complexity5(n):
"""
Test that peaked Distributions have zero complexity.
"""
d = ScalarDistribution([1] + [0]*(n-1))
d.make_dense()
d = Distribution.from_distribution(d)
assert LMPR_complexity(d) == pytest.approx(0)
示例3: test_disequilibrium6
# 需要導入模塊: from dit import ScalarDistribution [as 別名]
# 或者: from dit.ScalarDistribution import make_dense [as 別名]
def test_disequilibrium6():
"""
Test that peaked Distributions have non-zero disequilibrium.
"""
for n in range(2, 11):
d = ScalarDistribution([1] + [0]*(n-1))
d.make_dense()
d = Distribution.from_distribution(d)
yield assert_greater, disequilibrium(d), 0
示例4: test_LMPR_complexity4
# 需要導入模塊: from dit import ScalarDistribution [as 別名]
# 或者: from dit.ScalarDistribution import make_dense [as 別名]
def test_LMPR_complexity4():
"""
Test that peaked Distributions have zero complexity.
"""
for n in range(2, 11):
d = ScalarDistribution([1] + [0]*(n-1))
d.make_dense()
d = Distribution.from_distribution(d)
yield assert_almost_equal, LMPR_complexity(d), 0
示例5: test_is_approx_equal2
# 需要導入模塊: from dit import ScalarDistribution [as 別名]
# 或者: from dit.ScalarDistribution import make_dense [as 別名]
def test_is_approx_equal2():
d1 = ScalarDistribution([1 / 2, 1 / 2, 0])
d1.make_dense()
d2 = ScalarDistribution([1 / 2, 0, 1 / 2])
d2.make_dense()
assert_false(d1.is_approx_equal(d2))
示例6: test_del2
# 需要導入模塊: from dit import ScalarDistribution [as 別名]
# 或者: from dit.ScalarDistribution import make_dense [as 別名]
def test_del2():
d = ScalarDistribution([1 / 2, 1 / 2])
d.make_dense()
del d[1]
d.normalize()
assert_almost_equal(d[0], 1)