本文整理汇总了Python中dit.Distribution.marginal方法的典型用法代码示例。如果您正苦于以下问题:Python Distribution.marginal方法的具体用法?Python Distribution.marginal怎么用?Python Distribution.marginal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dit.Distribution
的用法示例。
在下文中一共展示了Distribution.marginal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_to_string8
# 需要导入模块: from dit import Distribution [as 别名]
# 或者: from dit.Distribution import marginal [as 别名]
def test_to_string8():
outcomes = ['00', '01', '10', '11']
pmf = [1/4]*4
d = Distribution(outcomes, pmf)
d = d.marginal([0])
s = d.to_string(show_mask='!')
s_ = """Class: Distribution
Alphabet: ('0', '1') for all rvs
Base: linear
Outcome Class: str
Outcome Length: 1 (mask: 2)
RV Names: None
x p(x)
0! 0.5
1! 0.5"""
assert_equal(s, s_)
示例2: test_to_string4
# 需要导入模块: from dit import Distribution [as 别名]
# 或者: from dit.Distribution import marginal [as 别名]
def test_to_string4():
# Basic with marginal
outcomes = ['00', '01', '10', '11']
pmf = [1/4]*4
d = Distribution(outcomes, pmf)
d = d.marginal([0])
s = d.to_string()
s_ = """Class: Distribution
Alphabet: ('0', '1') for all rvs
Base: linear
Outcome Class: str
Outcome Length: 1
RV Names: None
x p(x)
0 0.5
1 0.5"""
assert_equal(s, s_)