Example #1
0
def test_gauss_2d_mean():
    params_true = [4, 4]
    cov_matrix = [[1, .5], [.5, 1]]

    m = gauss.get_model(true_params=params_true,
                        nd_mean=True,
                        cov_matrix=cov_matrix)
    rej = elfi.Rejection(m, m['d'], batch_size=10)
    rej.sample(20)
def test_compare_models():
    m = gauss.get_model()
    res1 = elfi.Rejection(m['d']).sample(100)

    # use less informative prior
    m['mu'].become(elfi.Prior('uniform', -10, 50))
    res2 = elfi.Rejection(m['d']).sample(100)

    # use different simulator
    m['gauss'].become(
        elfi.Simulator(ma2.MA2,
                       m['mu'],
                       m['sigma'],
                       observed=m.observed['gauss']))
    res3 = elfi.Rejection(m['d']).sample(100)

    p = elfi.compare_models([res1, res2, res3])
    assert p[0] > p[1]
    assert p[1] > p[2]
Example #3
0
def test_gauss():
    m = gauss.get_model()
    rej = elfi.Rejection(m, m['d'], batch_size=10)
    rej.sample(20)