Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@pytest.mark.parametrize("metric", [None, IdentityMetric(3),
IsotropicMetric(3),
DiagonalMetric(np.ones(3)),
DenseMetric(np.eye(3))])
@pytest.mark.parametrize("pool", [True, False])
@pytest.mark.parametrize("tune", [True, False])
@pytest.mark.parametrize("blobs", [True, False])
def test_normal_nuts(pool, metric, tune, blobs, **kwargs):
if pool:
kwargs["pool"] = Pool()
if tune:
move = moves.NoUTurnMove(ntune=300)
else:
move = moves.NoUTurnMove()
kwargs["ndim"] = 3
kwargs["check_acceptance"] = False
kwargs["nsteps"] = 100
kwargs["blobs"] = blobs
_test_normal(move, **kwargs)
if pool:
kwargs["pool"].close()
@pytest.mark.parametrize("metric", [None, IdentityMetric(3),
IsotropicMetric(3),
DiagonalMetric(np.ones(3)),
DenseMetric(np.eye(3))])
@pytest.mark.parametrize("pool", [True, False])
@pytest.mark.parametrize("tune", [True, False])
@pytest.mark.parametrize("blobs", [True, False])
def test_normal_nuts(pool, metric, tune, blobs, **kwargs):
if pool:
kwargs["pool"] = Pool()
if tune:
move = moves.NoUTurnMove(ntune=300)
else:
move = moves.NoUTurnMove()
kwargs["ndim"] = 3
kwargs["check_acceptance"] = False
kwargs["nsteps"] = 100
kwargs["blobs"] = blobs
_test_normal(move, **kwargs)
if pool:
kwargs["pool"].close()
def test_normal_de_no_gamma(**kwargs):
_test_normal(moves.DEMove(1e-2, 1e-2), **kwargs)
def test_normal_hmc(pool, metric, tune, blobs, **kwargs):
if pool:
kwargs["pool"] = Pool()
if tune:
move = moves.HamiltonianMove(10, ntune=300, parallel_safe=pool)
else:
move = moves.HamiltonianMove(10, parallel_safe=pool)
kwargs["ndim"] = 3
kwargs["check_acceptance"] = False
kwargs["nsteps"] = 100
kwargs["blobs"] = blobs
_test_normal(move, **kwargs)
if pool:
kwargs["pool"].close()
def test_normal_de(**kwargs):
_test_normal(moves.DEMove(1e-2), **kwargs)
def test_normal_hmc(pool, metric, tune, blobs, **kwargs):
if pool:
kwargs["pool"] = Pool()
if tune:
move = moves.HamiltonianMove(10, ntune=300, parallel_safe=pool)
else:
move = moves.HamiltonianMove(10, parallel_safe=pool)
kwargs["ndim"] = 3
kwargs["check_acceptance"] = False
kwargs["nsteps"] = 100
kwargs["blobs"] = blobs
_test_normal(move, **kwargs)
if pool:
kwargs["pool"].close()