本文整理汇总了Python中dit.ScalarDistribution.event_space方法的典型用法代码示例。如果您正苦于以下问题:Python ScalarDistribution.event_space方法的具体用法?Python ScalarDistribution.event_space怎么用?Python ScalarDistribution.event_space使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dit.ScalarDistribution
的用法示例。
在下文中一共展示了ScalarDistribution.event_space方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dist_from_induced
# 需要导入模块: from dit import ScalarDistribution [as 别名]
# 或者: from dit.ScalarDistribution import event_space [as 别名]
def test_dist_from_induced():
""" Test dist_from_induced_sigalg """
outcomes = [(0,), (1,), (2,)]
pmf = np.array([1/3] * 3)
d = ScalarDistribution(outcomes, pmf)
sigalg = frozenset(map(frozenset, d.event_space()))
d2 = dist_from_induced_sigalg(d, sigalg)
assert np.allclose(pmf, d2.pmf)
sigalg = [(), ((0,),), ((1,), (2,)), ((0,), (1,), (2,))]
sigalg = frozenset(map(frozenset, sigalg))
d2 = dist_from_induced_sigalg(d, sigalg, int_outcomes=True)
pmf = np.array([1/3, 2/3])
assert np.allclose(pmf, d2.pmf)
d2 = dist_from_induced_sigalg(d, sigalg, int_outcomes=False)
outcomes = (((0,),), ((1,), (2,)))
assert outcomes == d2.outcomes