Пример #1
0
 def _resample_multiple(states_list):
     from pyhsmm.internals.hsmm_messages_interface import resample_log_multiple
     if len(states_list) > 0:
         Ts = [s.T for s in states_list]
         longest = np.argmax(Ts)
         stateseqs = [np.empty(T,dtype=np.int32) for T in Ts]
         loglikes = resample_log_multiple(
                 states_list[0].trans_matrix,
                 states_list[0].pi_0,
                 states_list[longest].aDl,
                 states_list[longest].aDsl,
                 [s.aBl for s in states_list],
                 np.array([s.right_censoring for s in states_list],dtype=np.int32),
                 np.array([s.trunc for s in states_list],dtype=np.int32),
                 stateseqs,
                 )
         for s, loglike, stateseq in zip(states_list,loglikes,stateseqs):
             s._normalizer = loglike
             s.stateseq = stateseq
Пример #2
0
 def _resample_multiple(states_list):
     from pyhsmm.internals.hsmm_messages_interface import resample_log_multiple
     if len(states_list) > 0:
         Ts = [s.T for s in states_list]
         longest = np.argmax(Ts)
         stateseqs = [np.empty(T,dtype=np.int32) for T in Ts]
         loglikes = resample_log_multiple(
                 states_list[0].trans_matrix,
                 states_list[0].pi_0,
                 states_list[longest].aDl,
                 states_list[longest].aDsl,
                 [s.aBl for s in states_list],
                 np.array([s.right_censoring for s in states_list],dtype=np.int32),
                 np.array([s.trunc for s in states_list],dtype=np.int32),
                 stateseqs,
                 )
         for s, loglike, stateseq in zip(states_list,loglikes,stateseqs):
             s._normalizer = loglike
             s.stateseq = stateseq