本文整理匯總了Python中dit.Distribution.set_base方法的典型用法代碼示例。如果您正苦於以下問題:Python Distribution.set_base方法的具體用法?Python Distribution.set_base怎麽用?Python Distribution.set_base使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dit.Distribution
的用法示例。
在下文中一共展示了Distribution.set_base方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_init12
# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import set_base [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))
示例2: test_to_string9
# 需要導入模塊: from dit import Distribution [as 別名]
# 或者: from dit.Distribution import set_base [as 別名]
def test_to_string9():
# Basic
outcomes = ['00', '01', '10', '11']
pmf = [1/4]*4
d = Distribution(outcomes, pmf)
d.set_base(2)
s = d.to_string()
s_ = """Class: Distribution
Alphabet: ('0', '1') for all rvs
Base: 2
Outcome Class: str
Outcome Length: 2
RV Names: None
x log p(x)
00 -2.0
01 -2.0
10 -2.0
11 -2.0"""
assert_equal(s, s_)