Skip to content

Commit 7a50430

Browse files
authored
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...
1 parent 76f3a7b commit 7a50430

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: pymc3/gp/gp.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def _build_prior(self, name, X, reparameterize=True, **kwargs):
266266
cov = stabilize(self.cov_func(X))
267267
shape = infer_shape(X, kwargs.pop("shape", None))
268268
if reparameterize:
269-
chi2 = pm.ChiSquared("chi2_", self.nu)
269+
chi2 = pm.ChiSquared(name + "_chi2_", self.nu)
270270
v = pm.Normal(name + "_rotated_", mu=0.0, sigma=1.0, shape=shape, **kwargs)
271271
f = pm.Deterministic(name, (tt.sqrt(self.nu) / chi2) * (mu + cholesky(cov).dot(v)))
272272
else:

Diff for: pymc3/tests/test_gp.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1015,8 +1015,8 @@ def testTPvsLatentReparameterized(self):
10151015
p = tp.conditional("p", self.Xnew)
10161016
chol = np.linalg.cholesky(cov_func(self.X).eval())
10171017
y_rotated = np.linalg.solve(chol, self.y)
1018-
# testing full model logp unreliable due to introduction of chi2__log__
1019-
plogp = p.logp({"f_rotated_": y_rotated, "p": self.pnew, "chi2__log__": np.log(1e20)})
1018+
# testing full model logp unreliable due to introduction of f_chi2__log__
1019+
plogp = p.logp({"f_rotated_": y_rotated, "p": self.pnew, "f_chi2__log__": np.log(1e20)})
10201020
npt.assert_allclose(self.plogp, plogp, atol=0, rtol=1e-2)
10211021

10221022
def testAdditiveTPRaises(self):

0 commit comments

Comments
 (0)