def another_simple_model(): _model = models.simple_model()[1] with _model: pm.Potential("pot", at.ones((10, 10))) return _model
def test_accuracy_normal(): _, model, (mu, _) = simple_model() with model: newstart = find_MAP(Point(x=[-10.5, 100.5])) close_to(newstart["x"], [mu, mu], select_by_precision(float64=1e-5, float32=1e-4))
def test_logp(): start, model, (mu, sig) = simple_model() lp = model.fastlogp lp(start) close_to(lp(start), sp.norm.logpdf(start["x"], mu, sig).sum(), tol)
def test_dlogp(): start, model, (mu, sig) = simple_model() dlogp = model.fastdlogp() close_to(dlogp(start), -(start["x"] - mu) / sig**2, 1.0 / sig**2 / 100.0)
def setup_method(self): _, self.model, _ = simple_model()