當前位置: 首頁>>代碼示例>>Python>>正文


Python Distribution.from_distribution方法代碼示例

本文整理匯總了Python中dit.Distribution.from_distribution方法的典型用法代碼示例。如果您正苦於以下問題:Python Distribution.from_distribution方法的具體用法?Python Distribution.from_distribution怎麽用?Python Distribution.from_distribution使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dit.Distribution的用法示例。


在下文中一共展示了Distribution.from_distribution方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_LMPR_complexity3

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [as 別名]
def test_LMPR_complexity3():
    """
    Test that uniform Distirbutions have zero complexity.
    """
    for n in range(2, 11):
        d = Distribution.from_distribution(uniform(n))
        yield assert_almost_equal, LMPR_complexity(d), 0
開發者ID:manolomartinez,項目名稱:dit,代碼行數:9,代碼來源:test_disequilibrium.py

示例2: test_disequilibrium4

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [as 別名]
def test_disequilibrium4():
    """
    Test that uniform Distributions have zero disequilibrium.
    """
    for n in range(2, 11):
        d = Distribution.from_distribution(uniform(n))
        yield assert_almost_equal, disequilibrium(d), 0
開發者ID:manolomartinez,項目名稱:dit,代碼行數:9,代碼來源:test_disequilibrium.py

示例3: test_disequilibrium6

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [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
開發者ID:Autoplectic,項目名稱:dit,代碼行數:10,代碼來源:test_disequilibrium.py

示例4: test_LMPR_complexity5

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [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)
開發者ID:Autoplectic,項目名稱:dit,代碼行數:10,代碼來源:test_disequilibrium.py

示例5: test_disequilibrium6

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [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
開發者ID:manolomartinez,項目名稱:dit,代碼行數:11,代碼來源:test_disequilibrium.py

示例6: test_LMPR_complexity4

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [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
開發者ID:manolomartinez,項目名稱:dit,代碼行數:11,代碼來源:test_disequilibrium.py

示例7: test_H5

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [as 別名]
def test_H5():
    """ Test H for uniform distributions in various bases """
    for i in range(2, 10):
        d = D.from_distribution(uniform(i))
        d.set_base(i)
        yield assert_almost_equal, H(d), 1
開發者ID:gto00002,項目名稱:dit,代碼行數:8,代碼來源:test_entropy.py

示例8: test_H4

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [as 別名]
def test_H4():
    """ Test H for uniform distributions """
    for i in range(2, 10):
        d = D.from_distribution(uniform(i))
        yield assert_almost_equal, H(d), np.log2(i)
開發者ID:gto00002,項目名稱:dit,代碼行數:7,代碼來源:test_entropy.py

示例9: test_H5

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [as 別名]
def test_H5(i):
    """ Test H for uniform distributions in various bases """
    d = D.from_distribution(uniform(i))
    d.set_base(i)
    assert H(d) == pytest.approx(1)
開發者ID:Autoplectic,項目名稱:dit,代碼行數:7,代碼來源:test_entropy.py

示例10: test_H4

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [as 別名]
def test_H4(i):
    """ Test H for uniform distributions """
    d = D.from_distribution(uniform(i))
    assert H(d) == pytest.approx(np.log2(i))
開發者ID:Autoplectic,項目名稱:dit,代碼行數:6,代碼來源:test_entropy.py

示例11: test_LMPR_complexity3

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [as 別名]
def test_LMPR_complexity3(n):
    """
    Test that uniform Distirbutions have zero complexity.
    """
    d = Distribution.from_distribution(uniform(n))
    assert LMPR_complexity(d) == pytest.approx(0)
開發者ID:Autoplectic,項目名稱:dit,代碼行數:8,代碼來源:test_disequilibrium.py

示例12: test_disequilibrium4

# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import from_distribution [as 別名]
def test_disequilibrium4(n):
    """
    Test that uniform Distributions have zero disequilibrium.
    """
    d = Distribution.from_distribution(uniform(n))
    assert disequilibrium(d) == pytest.approx(0)
開發者ID:Autoplectic,項目名稱:dit,代碼行數:8,代碼來源:test_disequilibrium.py


注:本文中的dit.Distribution.from_distribution方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。