From 0e397ac7f3350e96b0a2b551229cbe5563fe532a Mon Sep 17 00:00:00 2001 From: Benjamin Antin Date: Fri, 13 Dec 2019 12:26:12 -0800 Subject: [PATCH] Fix invert for _AutoregressiveEmissionsMixin Addresses issue #76 --- ssm/emissions.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ssm/emissions.py b/ssm/emissions.py index c5f8b6c5..5b8d2de3 100644 --- a/ssm/emissions.py +++ b/ssm/emissions.py @@ -758,8 +758,9 @@ def log_likelihoods(self, data, input, mask, tag, x): return np.sum(lls * mask[:, None, :], axis=2) def invert(self, data, input=None, mask=None, tag=None): - pad = np.zeros((1, 1, self.N)) if self.single_subspace else np.zeros((1, self.K, self.N)) - resid = data - np.concatenate((pad, self.As[None, :, :] * data[:-1, None, :])) + assert self.single_subspace, "Can only invert with a single emission model" + pad = np.zeros((1, self.N)) + resid = data - np.concatenate((pad, self.As * data[:-1])) return self._invert(resid, input=input, mask=mask, tag=tag) def sample(self, z, x, input=None, tag=None):