def test_checkpointing(nprocs, proposal_name): """Performs the same checkpointing test as for the PTSampler. """ model = Model() proposal = _setup_proposal(model, proposal_name) _test_checkpointing(Model, nprocs, proposals=[proposal], init_iters=STABILITY_DURATION-2)
def test_clear_memory(proposal_name, nprocs): """Runs the PTSampler ``test_clear_memoory`` using the adaptive normal proposal. """ model = Model() proposal = _setup_proposal(proposal_name, model.params, model.prior_bounds) _test_clear_memory(Model, nprocs, SWAP_INTERVAL, proposals=[proposal])
def test_checkpointing(nprocs, proposal_name): """Performs the same checkpointing test as for the PTSampler, but using the adaptive normal proposal. """ model = Model() proposal = _setup_proposal(model, proposal_name) _test_checkpointing(Model, nprocs, proposals=[proposal])
def test_clear_memory(nprocs, proposal_name): """Runs the PTSampler ``test_clear_memoory`` using the adaptive normal proposal. """ model = Model() proposal = _setup_proposal(model, proposal_name) _test_clear_memory(Model, nprocs, SWAP_INTERVAL, proposals=[proposal])
def test_checkpointing(proposal_name, nprocs): """Performs the same checkpointing test as for the PTSampler, but using the adaptive normal proposal. """ model = Model() proposal = _setup_proposal(proposal_name, model.params, model.prior_bounds) _test_checkpointing(Model, nprocs, proposals=[proposal])
def test_seed(nprocs, proposal_name): """Runs the PTSampler ``test_seed`` using the adaptive normal proposal. """ model = Model() proposal = _setup_proposal(model, proposal_name) _test_seed(Model, nprocs, proposals=[proposal], init_iters=STABILITY_DURATION-2)
def test_chains(name, nprocs): """Runs the PTSampler ``test_chains`` test using the adaptive proposal. """ model = Model() # we'll just use the adaptive normal for one of the params, to test # that using mixed proposals works proposal = _setup_proposal(model, name, params=[list(model.params)[0]]) _test_chains(Model, nprocs, SWAP_INTERVAL, proposals=[proposal])
def test_scale_changes(nprocs, proposal_name, model=None): """Tests that the eigenvalues change after a few jumps for the type of proposal specified by ``proposal_name``. """ # use the test model if model is None: model = Model() proposal = _setup_proposal(model, proposal_name) _test_scale_changes(nprocs, proposal, model)
def test_std_changes(nprocs, proposal_name, model=None): """Tests that the standard deviation changes after a few jumps for the type of proposal specified by ``proposal_name``. """ # use the test model if model is None: model = Model() proposal = _setup_proposal(model, proposal_name) _test_std_changes(nprocs, proposal, model)
def test_checkpointing(proposal_name, nprocs): """Performs the same checkpointing test as for the PTSampler, but using the adaptive normal proposal. """ model = Model() proposal = _setup_proposal(model, proposal_name, model.prior_bounds) _test_checkpointing(Model, nprocs, proposals=[proposal], init_iters=STABILITY_DURATION)
def test_chains(nprocs, proposal_name): """Runs the PTSampler ``test_chains`` test using the adaptive normal proposal. """ model = Model() # we'll just use the adaptive normal for one of the params, to test # that using mixed proposals works proposal = _setup_proposal(model, proposal_name, params=[list(model.params)[0]]) _test_chains(Model, nprocs, SWAP_INTERVAL, proposals=[proposal], init_iters=STABILITY_DURATION-2)
def test_chains(proposal_name, nprocs): """Runs the PTSampler ``test_chains`` test using the bounded normal proposal. """ model = Model() # we'll just the bounded normal proposal for one of the parameters, # to test that using mixed proposals works param = list(model.params)[0] proposal = _setup_proposal(proposal_name, [param], {param: model.prior_bounds[param]}) _test_chains(Model, nprocs, SWAP_INTERVAL, proposals=[proposal])
def test_clear_memory(proposal_name, nprocs): """Runs the PTSampler ``test_clear_memoory`` using the adaptive normal proposal. """ model = Model() proposal = _setup_proposal(model, proposal_name, model.prior_bounds) _test_clear_memory(Model, nprocs, SWAP_INTERVAL, proposals=[proposal], init_iters=STABILITY_DURATION)
def test_cov_changes(name, nprocs, diagonal, componentwise, model=None): """Tests that the covariance changes after a few jumps.""" # use the test model if not diagonal and name in ['at_adaptive_bounded_normal', 'at_adaptive_angular']: return if model is None: model = Model() proposal = _setup_proposal(model, name, diagonal=diagonal, componentwise=componentwise) if proposal.isdiagonal: _test_std_changes(nprocs, proposal, model) else: _test_cov_changes(nprocs, proposal, model)
def test_jumps_in_bounds(proposal_name, xmin, xmax): """Runs the proposal for a couple of steps and checks that suggested eigenvector jumps are in bounds. """ model = Model() bnd = Boundaries((xmin, xmax)) model.prior_bounds.update({'x0': bnd}) model.prior_dist.update({'x0': stats.uniform(bnd.lower, abs(bnd))}) bounds = {'x0': (xmin, xmax), 'x1': (-40., 40.0)} # create the proposal and the sampler proposal = _setup_proposal(model, proposal_name, bounds) sampler = _create_sampler(model, nprocs=1, proposals=[proposal]) # Run the sampler through its stability and adaptation phase # This will throw an exception in case any suggested points out of bounds sampler.run(STABILITY_DURATION + ADAPTATION_DURATION)
def test_seed(proposal_name, nprocs): """Runs the PTSampler ``test_seed`` using the adaptive normal proposal. """ model = Model() proposal = _setup_proposal(proposal_name, model.params, model.prior_bounds) _test_seed(Model, nprocs, proposals=[proposal])
def test_seed(nprocs, proposal_name): """Runs the PTSampler ``test_seed`` using the adaptive normal proposal. """ model = Model() proposal = _setup_proposal(model, proposal_name) _test_seed(Model, nprocs, proposals=[proposal])
def test_seed(name, nprocs, componentwise): """Runs the PTSampler ``test_seed`` using the adaptive proposal. """ model = Model() proposal = _setup_proposal(model, name, componentwise=componentwise) _test_seed(Model, nprocs, proposals=[proposal])