APEMoST
Defines | Functions

src/markov_chain.c File Reference

#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 Documentation

#define MAXIMAL_STEPWIDTH   1000000

Referenced by rmw_adapt_stepwidth().

#define MINIMAL_STEPWIDTH   0.0000001

Referenced by rmw_adapt_stepwidth().


Function Documentation

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.

Parameters:
m
param
desired_acceptance_rate
min_accuracyyou 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_accuracyyou 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_ratehere the a/r gets stored
accuracyhere the accuracy gets stored
Returns:
iterations used

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 
)
void clear_bit ( char *  bitfield,
unsigned int  i 
)

Referenced by assess_acceptance_rate().

void do_step_for ( mcmc m,
const unsigned int  i 
)
int get_bit ( char *  bitfield,
unsigned int  i 
)

Referenced by assess_acceptance_rate().

void markov_chain_step ( mcmc m)
void markov_chain_step_for ( mcmc m,
const unsigned int  index 
)

take a step using the markov-chain for the indexth parameter

Parameters:
m
indexthe 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 
)
void set_bit ( char *  bitfield,
unsigned int  i 
)

Referenced by assess_acceptance_rate().