def _expected_durations(self,
dur_potentials,cumulative_obs_potentials,
alphastarl,betal,normalizer):
logpmfs = -np.inf*np.ones((self.Tfull,alphastarl.shape[1]))
errs = np.seterr(invalid='ignore') # logaddexp(-inf,-inf)
# TODO censoring not handled correctly here
for tblock in xrange(self.Tblock):
possible_durations = self.segmentlens[tblock:].cumsum()[:self.trunc]
cB, offset = cumulative_obs_potentials(tblock)
logpmfs[possible_durations -1] = np.logaddexp(
dur_potentials(tblock) + alphastarl[tblock]
+ betal[tblock:tblock+self.trunc if self.trunc is not None else None]
+ cB - (offset + normalizer),
logpmfs[possible_durations -1])
np.seterr(**errs)
return np.exp(logpmfs.T)
###################
# sparate trans #
###################
评论列表
文章目录