def hmm_messages_forwards(self):
     alphal = HMMStatesEigen._messages_forwards_log(
             self.hmm_fwd_trans_matrix,
             self.hmm_fwd_pi_0,
             self.hmm_aBl)
     self._normalier = np.logaddexp.reduce(alphal[-1])
     return alphal
Exemple #2
0
 def hmm_messages_forwards(self):
     alphal = HMMStatesEigen._messages_forwards_log(
             self.hmm_fwd_trans_matrix,
             self.hmm_fwd_pi_0,
             self.hmm_aBl)
     self._normalier = np.logaddexp.reduce(alphal[-1])
     return alphal
Exemple #3
0
    def E_step(self):
        alphal = HMMStatesEigen._messages_forwards_log(self.hmm_trans_matrix, self.pi_0, self.aBl)
        betal = HMMStatesEigen._messages_backwards_log(self.hmm_trans_matrix, self.aBl)
        self.expected_states, self.expected_transcounts, self._normalizer = HMMStatesPython._expected_statistics_from_messages(
            self.hmm_trans_matrix, self.aBl, alphal, betal
        )

        # using these is untested!
        self._expected_ns = np.diag(self.expected_transcounts).copy()
        self._expected_tots = self.expected_transcounts.sum(1)

        self.expected_transcounts.flat[:: self.expected_transcounts.shape[0] + 1] = 0.0
Exemple #4
0
    def E_step(self):
        alphal = HMMStatesEigen._messages_forwards_log(self.hmm_trans_matrix,
                                                       self.pi_0, self.aBl)
        betal = HMMStatesEigen._messages_backwards_log(self.hmm_trans_matrix,
                                                       self.aBl)
        self.expected_states, self.expected_transcounts, self._normalizer = \
                HMMStatesPython._expected_statistics_from_messages(
                        self.hmm_trans_matrix,
                        self.aBl,
                        alphal,
                        betal)

        # using these is untested!
        self._expected_ns = np.diag(self.expected_transcounts).copy()
        self._expected_tots = self.expected_transcounts.sum(1)

        self.expected_transcounts.flat[::self.expected_transcounts.shape[0] +
                                       1] = 0.
Exemple #5
0
 def hmm_messages_forwards_log(self):
     return HMMStatesEigen._messages_forwards_log(self.hmm_trans_matrix,
                                                  self.hmm_pi_0,
                                                  self.hmm_aBl)
Exemple #6
0
 def hmm_messages_forwards_log(self):
     return HMMStatesEigen._messages_forwards_log(
             self.hmm_trans_matrix,self.hmm_pi_0,self.hmm_aBl)