APEMoST
|
#include <string.h>
#include <stdio.h>
#include <libgen.h>
#include "mcmc.h"
#include "mcmc_internal.h"
#include "debug.h"
#include "gsl_helper.h"
#include <gsl/gsl_sf.h>
Defines | |
#define | MINIMAL_STEPWIDTH 0.0000001 |
#define | MAXIMAL_STEPWIDTH 1000000 |
Functions | |
void | restart_from_best (mcmc *m) |
void | burn_in (mcmc *m, const unsigned int burn_in_iterations) |
void | clear_bit (char *bitfield, unsigned int i) |
void | set_bit (char *bitfield, unsigned int i) |
int | get_bit (char *bitfield, unsigned int i) |
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 | do_step_for (mcmc *m, const unsigned int i) |
void | markov_chain_step_for (mcmc *m, const unsigned int index) |
void | rmw_adapt_stepwidth (mcmc *m, const double prob_old) |
void | markov_chain_step (mcmc *m) |
#define MAXIMAL_STEPWIDTH 1000000 |
Referenced by rmw_adapt_stepwidth().
#define MINIMAL_STEPWIDTH 0.0000001 |
Referenced by rmw_adapt_stepwidth().
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.
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 clear_bit | ( | char * | bitfield, |
unsigned int | i | ||
) |
Referenced by assess_acceptance_rate().
void do_step_for | ( | mcmc * | m, |
const unsigned int | i | ||
) |
References assert, CIRCULAR_PARAMS, get_next_random_jump(), IFVERBOSE, mod_double, mcmc::params, mcmc::params_max, mcmc::params_min, mcmc::params_step, and set_params_for().
Referenced by markov_chain_step_for().
int get_bit | ( | char * | bitfield, |
unsigned int | i | ||
) |
Referenced by assess_acceptance_rate().
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().
void set_bit | ( | char * | bitfield, |
unsigned int | i | ||
) |
Referenced by assess_acceptance_rate().