APEMoST
|
Go to the source code of this file.
Defines | |
#define | DEFAULT_ADJUST_STEP 0.5 |
#define | NO_RESCALING_LIMIT 15 |
#define | ITER_READJUST 200 |
#define | CIRCULAR_PARAMS 0 |
#define | ACCURACY_DEVIATION_FACTOR 0.25 |
Functions | |
void | markov_chain_calibrate (mcmc *m, const unsigned int burn_in_iterations, double desired_acceptance_rate, const double max_ar_deviation, const unsigned int iter_limit, double mul, const double adjust_step) |
void | markov_chain_step (mcmc *m) |
void | markov_chain_step_for (mcmc *m, const unsigned int index) |
void | rmw_adapt_stepwidth (mcmc *m, double prob_old) |
void | burn_in (mcmc *m, const unsigned int burn_in_iterations) |
unsigned int | assess_acceptance_rate (mcmc *m, unsigned int param, double desired_acceptance_rate, double min_accuracy, double max_accuracy, double *acceptance_rate, double *accuracy) |
void | restart_from_best (mcmc *m) |
#define ACCURACY_DEVIATION_FACTOR 0.25 |
How good should the acceptance rate be calculated in dependence of deviation from the desired value? accuracy = factor * deviation
Referenced by assess_acceptance_rate().
#define CIRCULAR_PARAMS 0 |
Which parameters are circular?
e.g. if the first and second parameters are angles, you write CIRCULAR_PARAMS=1,2; Do not use zero for the first parameter.
N.B.: if you have a angle, you will want to make it go from 0 to 1 or similar and use pi in your formula. This way it will be more exact.
Referenced by do_step_for().
#define DEFAULT_ADJUST_STEP 0.5 |
Referenced by calibrate_first(), and calibrate_rest().
#define ITER_READJUST 200 |
Referenced by markov_chain_calibrate_orig().
#define NO_RESCALING_LIMIT 15 |
Referenced by markov_chain_calibrate_orig().
unsigned int assess_acceptance_rate | ( | mcmc * | m, |
unsigned int | param, | ||
double | desired_acceptance_rate, | ||
double | min_accuracy, | ||
double | max_accuracy, | ||
double * | acceptance_rate, | ||
double * | accuracy | ||
) |
Get acceptance rate. The closer the acceptance rate is to the desired acceptance rate, the more accurately will it be assessed.
min_accuracy | you can request a upper limit on the accuracy, e.g. 1%. any calculation will have at most the accuracy of 1% then. Otherwise put 0 here. |
max_accuracy | you can request a lower limit on the accuracy, e.g. 0.1% any calculation will have at least the accuracy of 0.1% then. Otherwise put 1 here. |
acceptance_rate | here the a/r gets stored |
accuracy | here the accuracy gets stored |
Get acceptance rate. The closer the acceptance rate is to the desired acceptance rate, the more accurately will it be assessed.
m | |
param | |
desired_acceptance_rate | |
min_accuracy | you can request a upper limit on the accuracy, e.g. 1%. any calculation will have at most the accuracy of 1% then. Otherwise put 0 here. |
max_accuracy | you can request a lower limit on the accuracy, e.g. 0.1% any calculation will have at least the accuracy of 0.1% then. Otherwise put 1 here. |
acceptance_rate | here the a/r gets stored |
accuracy | here the accuracy gets stored |
References abs_double, ACCURACY_DEVIATION_FACTOR, assert, clear_bit(), get_bit(), get_n_par(), get_params_accepts_for(), get_params_accepts_global(), IFVERBOSE, markov_chain_step(), markov_chain_step_for(), mcmc_check_best(), reset_accept_rejects(), and set_bit().
Referenced by markov_chain_calibrate_alt(), markov_chain_calibrate_linear_regression(), markov_chain_calibrate_multilinear_regression(), and markov_chain_calibrate_quadratic().
void burn_in | ( | mcmc * | m, |
const unsigned int | burn_in_iterations | ||
) |
Perform the given number of burn-in operations
References debug, dump_ul, dump_v, dup_vector(), get_params(), get_steps(), IFVERBOSE, markov_chain_step(), mcmc_check(), mcmc_check_best(), mcmc::params_max, mcmc::params_min, mcmc::params_step, and restart_from_best().
Referenced by calibrate_rest(), and markov_chain_calibrate().
void markov_chain_calibrate | ( | mcmc * | m, |
const unsigned int | burn_in_iterations, | ||
double | desired_acceptance_rate, | ||
const double | max_ar_deviation, | ||
const unsigned int | iter_limit, | ||
double | mul, | ||
const double | adjust_step | ||
) |
create/calibrate the markov-chain
m | |
desired_acceptance_rate | average acceptance rates for individual parameters to be achieved |
max_ar_deviation | allowed deviation from desired_acceptance_rate |
burn_in_iterations | number of burn-in iterations |
iter_limit | number of iterations for step width calibration |
mul | factor for adjusting the step width during calibration |
adjust_step | gives the factor with which to adjust the stepwidths after burn-in |
References burn_in(), dump_d, markov_chain_calibrate_alt(), markov_chain_calibrate_multilinear_regression(), markov_chain_calibrate_orig(), and markov_chain_calibrate_quadratic().
Referenced by calibrate_first(), and calibrate_rest().
void markov_chain_step | ( | mcmc * | m | ) |
take a step using the markov-chain
m |
References calc_model(), dup_vector(), get_prob(), inc_params_accepts(), inc_params_rejects(), mcmc_check(), mcmc::params, and set_params().
Referenced by adapt(), assess_acceptance_rate(), burn_in(), markov_chain_calibrate_orig(), and run_sampler().
void markov_chain_step_for | ( | mcmc * | m, |
const unsigned int | index | ||
) |
take a step using the markov-chain for the indexth parameter
m | |
index | the param to look at |
References calc_model_for(), do_step_for(), get_prob(), inc_params_accepts_for(), inc_params_rejects_for(), mcmc_check(), mcmc::params, and set_params_for().
Referenced by assess_acceptance_rate(), and markov_chain_calibrate_orig().
void restart_from_best | ( | mcmc * | m | ) |
Set the best parameters value found so far as current value, as well as the probability.
References dup_vector(), get_params_best(), get_prob_best(), set_params(), and set_prob().
Referenced by burn_in(), and markov_chain_calibrate_orig().
void rmw_adapt_stepwidth | ( | mcmc * | m, |
double | prob_old | ||
) |
adapts the step width
References get_n_par(), get_next_uniform_random(), get_prob(), get_steps(), MAXIMAL_STEPWIDTH, MINIMAL_STEPWIDTH, mcmc::n_iter, mcmc::params_max, mcmc::params_min, and TARGET_ACCEPTANCE_RATE.
Referenced by adapt().