Exemple #1
0
def test_scalar_likelihood_quadrature_variational_expectation(likelihood_setup, mu, var):
    """
    Where quadrature methods have been overwritten, make sure the new code
    does something close to the quadrature.
    """
    likelihood, y = likelihood_setup.likelihood, likelihood_setup.Y
    F1 = likelihood.variational_expectations(mu, var, y)
    F2 = ScalarLikelihood.variational_expectations(likelihood, mu, var, y)
    assert_allclose(F1, F2, rtol=likelihood_setup.rtol, atol=likelihood_setup.atol)
def test_scalar_likelihood_quadrature_predict_log_density(
        likelihood_setup, mu, var):
    likelihood, y = likelihood_setup.likelihood, likelihood_setup.Y
    F1 = likelihood.predict_log_density(mu, var, y)
    F2 = ScalarLikelihood.predict_log_density(likelihood, mu, var, y)
    assert_allclose(F1,
                    F2,
                    rtol=likelihood_setup.rtol,
                    atol=likelihood_setup.atol)
def test_scalar_likelihood_quadrature_predict_mean_and_var(
        likelihood_setup, mu, var):
    likelihood = likelihood_setup.likelihood
    F1m, F1v = likelihood.predict_mean_and_var(mu, var)
    F2m, F2v = ScalarLikelihood.predict_mean_and_var(likelihood, mu, var)
    assert_allclose(F1m,
                    F2m,
                    rtol=likelihood_setup.rtol,
                    atol=likelihood_setup.atol)
    assert_allclose(F1v,
                    F2v,
                    rtol=likelihood_setup.rtol,
                    atol=likelihood_setup.atol)