def create_mh_model( mcmc_params ): if mcmc_params["type"] == "mh": mh_model = BaseMetropolisHastingsModel( mcmc_params ) elif mcmc_params["type"] == "amh": mh_model = AdaptiveMetropolisHastingsModel( mcmc_params ) elif mcmc_params["type"] == "sgldmh": mh_model = SGLD_MetropolisHastingsModel( mcmc_params ) else: raise NotImplementedError return mh_model
state_params["response_groups"] = [ResponseModel( response_model_params )] mcmc_params = {} mcmc_params["priorrand"] = problem.theta_prior_rand mcmc_params["logprior"] = problem.theta_prior_logpdf mcmc_params["proposal_rand"] = problem.theta_proposal_rand mcmc_params["logproposal"] = problem.theta_proposal_logpdf mcmc_params["is_marginal"] = False mcmc_params["nbr_samples"] = nbr_samples mcmc_params["xi"] = 0.1 mcmc_params["M"] = 10 mcmc_params["deltaS"] = 1 mcmc_params["max_nbr_tries"] = 10 mcmc_params["acquisition_model"] = AcquisitionModel(acquistion_params) model = MH_Model( mcmc_params) #epsilon = 0.5 theta0 = problem.theta_prior_rand() #theta0 *=0 #theta0 += 0.1 state = State( theta0, state_params ) recorder = Recorder(record_stats=True) #recorder.record_state( state, state.nbr_sim_calls, accepted=True ) model.set_current_state( state ) model.set_recorder( recorder ) loglik = state.loglikelihood()
state_params["response_groups"] = [ResponseModel(response_model_params)] mcmc_params = {} mcmc_params["priorrand"] = problem.theta_prior_rand mcmc_params["logprior"] = problem.theta_prior_logpdf mcmc_params["proposal_rand"] = problem.theta_proposal_rand mcmc_params["logproposal"] = problem.theta_proposal_logpdf mcmc_params["is_marginal"] = False mcmc_params["nbr_samples"] = nbr_samples mcmc_params["xi"] = 0.4 mcmc_params["M"] = 10 mcmc_params["deltaS"] = 1 mcmc_params["max_nbr_tries"] = 1 mcmc_params["acquisition_model"] = AcquisitionModel(acquistion_params) model = MH_Model(mcmc_params) #epsilon = 0.5 theta0 = problem.theta_prior_rand() #theta0 *=0 #theta0 += 0.1 state = State(theta0, state_params) recorder = Recorder(record_stats=True) #recorder.record_state( state, state.nbr_sim_calls, accepted=True ) model.set_current_state(state) model.set_recorder(recorder) loglik = state.loglikelihood()