当前位置: 首页>>代码示例>>Python>>正文


Python BirthDeathChain.committor_backward方法代码示例

本文整理汇总了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)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:27,代码来源:test_committor.py

示例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)
开发者ID:ismaelresp,项目名称:PyEMMA,代码行数:27,代码来源:test_committor.py


注:本文中的birth_death_chain.BirthDeathChain.committor_backward方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。