state_params["observation_groups"] = problem.get_obs_groups() state_params["simulation_function"] = problem.simulation_function state_params["statistics_function"] = problem.statistics_function state_params["response_groups"] = [Kernel( kernel_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 theta0 = problem.theta_prior_rand() state = State( 0.1+0*theta0, state_params ) loglik = state.loglikelihood() recorder = Recorder() recorder.record_state( state, state.nbr_sim_calls, accepted=True ) print "*************** RUNNING ABC MCMC ***************" thetas, LL, acceptances,sim_calls = abc_mcmc( mcmc_params, state, recorder ) print "*************** DONE ABC MCMC ***************" print "*************** VIEW RESULTS ***************" problem.view_results( recorder, burnin = nbr_samples/2 ) pp.show() print "*************** DONE VIEW ***************" print "TODO" print "verify kernel epsilon on stats"
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() #recorder.record_state( state, state.nbr_sim_calls, accepted=True ) print "*************** RUNNING SL MCMC ***************" thetas, LL, acceptances,sim_calls = abc_mcmc( nbr_samples, model, verbose = True ) print " ACCEPT RATE = %0.3f"%(recorder.acceptance_rate()) print "*************** DONE ABC MCMC ***************" print "*************** VIEW RESULTS ***************" problem.view_results( recorder, burnin = nbr_samples/2 ) pp.show() print "*************** DONE VIEW ***************" print "TODO" print "verify kernel epsilon on stats"
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() #recorder.record_state( state, state.nbr_sim_calls, accepted=True ) print "*************** RUNNING SL MCMC ***************" thetas, LL, acceptances, sim_calls = abc_mcmc(nbr_samples, model, verbose=True) print " ACCEPT RATE = %0.3f" % (recorder.acceptance_rate()) print "*************** DONE ABC MCMC ***************" print "*************** VIEW RESULTS ***************" problem.view_results(recorder, burnin=nbr_samples / 2) pp.show() print "*************** DONE VIEW ***************" print "TODO" print "verify kernel epsilon on stats"