本文整理汇总了Python中birth_death_chain.BirthDeathChain.committor_backward方法的典型用法代码示例。如果您正苦于以下问题:Python BirthDeathChain.committor_backward方法的具体用法?Python BirthDeathChain.committor_backward怎么用?Python BirthDeathChain.committor_backward使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类birth_death_chain.BirthDeathChain
的用法示例。
在下文中一共展示了BirthDeathChain.committor_backward方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestCommittorSparse
# 需要导入模块: from birth_death_chain import BirthDeathChain [as 别名]
# 或者: from birth_death_chain.BirthDeathChain import committor_backward [as 别名]
class TestCommittorSparse(unittest.TestCase):
def setUp(self):
p = np.zeros(100)
q = np.zeros(100)
p[0:-1] = 0.5
q[1:] = 0.5
p[49] = 0.01
q[51] = 0.1
self.bdc = BirthDeathChain(q, p)
def tearDown(self):
pass
def test_forward_comittor(self):
P = self.bdc.transition_matrix_sparse()
un = committor(P, range(10), range(90, 100), forward=True)
u = self.bdc.committor_forward(9, 90)
assert_allclose(un, u)
def test_backward_comittor(self):
P = self.bdc.transition_matrix_sparse()
un = committor(P, range(10), range(90, 100), forward=False)
u = self.bdc.committor_backward(9, 90)
assert_allclose(un, u)
示例2: TestCommittorDense
# 需要导入模块: from birth_death_chain import BirthDeathChain [as 别名]
# 或者: from birth_death_chain.BirthDeathChain import committor_backward [as 别名]
class TestCommittorDense(unittest.TestCase):
def setUp(self):
p = np.zeros(10)
q = np.zeros(10)
p[0:-1] = 0.5
q[1:] = 0.5
p[4] = 0.01
q[6] = 0.1
self.bdc = BirthDeathChain(q, p)
def tearDown(self):
pass
def test_forward_comittor(self):
P = self.bdc.transition_matrix()
un = committor(P, [0, 1], [8, 9], forward=True)
u = self.bdc.committor_forward(1, 8)
assert_allclose(un, u)
def test_backward_comittor(self):
P = self.bdc.transition_matrix()
un = committor(P, [0, 1], [8, 9], forward=False)
u = self.bdc.committor_backward(1, 8)
assert_allclose(un, u)