Unverified Commit 7a504305 authored by Bill Engels's avatar Bill Engels Committed by GitHub

Fix reparameterized gp.TP `chi2` variable name (#3945)

* reparameterized TP chi2 parameter has unique name now

* also fix TP chi2 name in tests

* remove path that somehow got to top of file...
parent 76f3a7b7
......@@ -266,7 +266,7 @@ class TP(Latent):
cov = stabilize(self.cov_func(X))
shape = infer_shape(X, kwargs.pop("shape", None))
if reparameterize:
chi2 = pm.ChiSquared("chi2_", self.nu)
chi2 = pm.ChiSquared(name + "_chi2_", self.nu)
v = pm.Normal(name + "_rotated_", mu=0.0, sigma=1.0, shape=shape, **kwargs)
f = pm.Deterministic(name, (tt.sqrt(self.nu) / chi2) * (mu + cholesky(cov).dot(v)))
else:
......
......@@ -1015,8 +1015,8 @@ class TestTP:
p = tp.conditional("p", self.Xnew)
chol = np.linalg.cholesky(cov_func(self.X).eval())
y_rotated = np.linalg.solve(chol, self.y)
# testing full model logp unreliable due to introduction of chi2__log__
plogp = p.logp({"f_rotated_": y_rotated, "p": self.pnew, "chi2__log__": np.log(1e20)})
# testing full model logp unreliable due to introduction of f_chi2__log__
plogp = p.logp({"f_rotated_": y_rotated, "p": self.pnew, "f_chi2__log__": np.log(1e20)})
npt.assert_allclose(self.plogp, plogp, atol=0, rtol=1e-2)
def testAdditiveTPRaises(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment