當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。