本文整理汇总了Python中graphillion.GraphSet.probability方法的典型用法代码示例。如果您正苦于以下问题:Python GraphSet.probability方法的具体用法?Python GraphSet.probability怎么用?Python GraphSet.probability使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphillion.GraphSet
的用法示例。
在下文中一共展示了GraphSet.probability方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_probability
# 需要导入模块: from graphillion import GraphSet [as 别名]
# 或者: from graphillion.GraphSet import probability [as 别名]
def test_probability(self):
p = {e1: .9, e2: .8, e3: .7, e4: .6}
gs = GraphSet()
self.assertEqual(gs.probability(p), 0)
gs = GraphSet([g0])
self.assertAlmostEqual(gs.probability(p), .0024)
gs = GraphSet([g1])
self.assertAlmostEqual(gs.probability(p), .0216)
gs = GraphSet([g2])
self.assertAlmostEqual(gs.probability(p), .0096)
gs = GraphSet([g12, g13])
self.assertAlmostEqual(gs.probability(p), .1368)
gs = GraphSet([g1234])
self.assertAlmostEqual(gs.probability(p), .3024)
gs = GraphSet([g0, g1, g2, g12, g13, g1234])
self.assertAlmostEqual(gs.probability(p), .4728)