def test_mle_jacobian(): """Test MAP / MLE estimation for distributions with flat priors.""" truth = 10.0 # Simple normal model should give mu=10.0 start, model, _ = models.simple_normal(bounded_prior=False) with model: map_estimate = find_MAP(method="BFGS", model=model) rtol = 1e-5 # this rtol should work on both floatX precisions np.testing.assert_allclose(map_estimate["mu_i"], truth, rtol=rtol) start, model, _ = models.simple_normal(bounded_prior=True) with model: map_estimate = find_MAP(method="BFGS", model=model) np.testing.assert_allclose(map_estimate["mu_i"], truth, rtol=rtol)
def test_mle_jacobian(): """Test MAP / MLE estimation for distributions with flat priors.""" truth = 10.0 # Simple normal model should give mu=10.0 start, model, _ = models.simple_normal(bounded_prior=False) with model: map_estimate = find_MAP(model=model) rtol = 1E-5 # this rtol should work on both floatX precisions np.testing.assert_allclose(map_estimate["mu_i"], truth, rtol=rtol) start, model, _ = models.simple_normal(bounded_prior=True) with model: map_estimate = find_MAP(model=model) np.testing.assert_allclose(map_estimate["mu_i"], truth, rtol=rtol)