def _expected_durations(self,
dur_potentials,cumulative_obs_potentials,
alphastarl,betal,normalizer):
if self.trunc is not None:
raise NotImplementedError, "_expected_durations can't handle trunc"
T = self.T
logpmfs = -np.inf*np.ones_like(alphastarl)
errs = np.seterr(invalid='ignore')
for t in xrange(T):
cB, offset = cumulative_obs_potentials(t)
np.logaddexp(dur_potentials(t) + alphastarl[t] + betal[t:] +
cB - (normalizer + offset),
logpmfs[:T-t], out=logpmfs[:T-t])
np.seterr(**errs)
expected_durations = np.exp(logpmfs.T)
return expected_durations
# TODO call this 'time homog'
评论列表
文章目录