Skip to content

Commit

Permalink
store log_lik_t in attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
xjing76 committed Mar 16, 2021
1 parent de16651 commit 697613b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pymc3_hmm/step_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def __init__(self, var, values=None, model=None):

self.gamma_0_fn = model.fn(var.distribution.gamma_0)
self.Gammas_fn = model.fn(var.distribution.Gammas)
self.log_lik_t = None

super().__init__([var], [dependents_log_lik], allvars=True)

Expand All @@ -160,8 +161,10 @@ def astep(self, point, log_lik_fn, inputs):
# could be missing out on a much more efficient/faster approach to this
# potentially large computation.
# state_seqs = np.broadcast_to(np.arange(M, dtype=int)[..., None], (M, N))
# log_lik_t = log_lik_fn(state_seqs)
log_lik_t = np.stack([log_lik_fn(np.broadcast_to(m, N)) for m in range(M)])
if self.log_lik_t is not None :
log_lik_t = self.log_lik_t
else:
log_lik_t = np.stack([log_lik_fn(np.broadcast_to(m, N)) for m in range(M)])

return ffbs_astep(gamma_0, Gammas_t, log_lik_t)

Expand Down

0 comments on commit 697613b

Please sign in to comment.