def posterior_sample(self, data, input=None, mask=None, tag=None): m = self.state_map pi0 = self.init_state_distn.initial_state_distn Ps = self.transitions.transition_matrices(data, input, mask, tag) log_likes = self.observations.log_likelihoods(data, input, mask, tag) z_smpl = hmm_sample(replicate(pi0, m), Ps, replicate(log_likes, m)) return self.state_map[z_smpl]
def sample_discrete_states(self): return [hmm_sample(prms["pi0"], prms["Ps"], prms["log_likes"]) for prms in self._discrete_state_params]