Patterns in static


apop_mcmc_settings Struct Reference

Data Fields

int accept_count
int(* base_adapt_fn )(struct apop_mcmc_proposal_s *ps, struct apop_mcmc_settings *ms)
void(* base_step_fn )(double const *, struct apop_mcmc_proposal_s *, struct apop_mcmc_settings *)
int block_count
size_t * block_starts
double burnin
char gibbs_chunks
int histosegments
double last_ll
long int periods
int proposal_count
int proposal_is_cp
int reject_count
char start_at
double target_accept_rate

Detailed Description

Method settings for a model to be put through Bayesian updating.

Field Documentation

int apop_mcmc_settings::accept_count

After calling apop_model_metropolis, this will have the number of accepted proposals.

int(* apop_mcmc_settings::base_adapt_fn)(struct apop_mcmc_proposal_s *ps, struct apop_mcmc_settings *ms)

If a apop_mcmc_proposal_s has NULL adapt_fn, use this. If you don't want an adapt function, set this to a do-nothing function.

apop_model * apop_mcmc_settings::base_model

The model you provided with a log_likelihood or p element (which need not sum to one). You do not have to set this: if it is NULL on input to apop_model_metropolis, I will fill it in.

void(* apop_mcmc_settings::base_step_fn)(double const *, struct apop_mcmc_proposal_s *, struct apop_mcmc_settings *)

If an apop_mcmc_proposal_s struct has NULL step_fn, use this. If you don't want a step function, set this to a do-nothing function.

size_t * apop_mcmc_settings::block_starts

For internal use

double apop_mcmc_settings::burnin

What percentage of the periods should be ignored as initialization. That is, this is a number between zero and one.

char apop_mcmc_settings::gibbs_chunks

See the apop_model_metropolis documentation for discussion.

'a': One step draws and accepts/rejects all parameters as a unit

'b': draw in blocks: the vector is a block, the matrix is a separate block, the weights are a separate block, and so on through every page of the model parameters. Each block of parameters is drawn and accepted/rejected as a unit.

'1': draw each parameter and accept/reject separately. One MCMC step consists of a set of draws for every parameter.

int apop_mcmc_settings::histosegments

If outputting a binned PMF, how many segments should it have?

double apop_mcmc_settings::last_ll

If you have already run MCMC, the last log likelihood in the chain.

long int apop_mcmc_settings::periods

For how many steps should the MCMC chain run?

apop_model * apop_mcmc_settings::pmf

If you have already run MCMC, I keep a pointer to the model so far here. Use apop_model_metropolis_draw to get one more draw.

int apop_mcmc_settings::proposal_count

The number of proposal sets; see gibbs_chunks below.

int apop_mcmc_settings::proposal_is_cp

For internal use.

apop_mcmc_proposal_s * apop_mcmc_settings::proposals

The list of proposals. You can probably use the default of adaptive multivariate normals. See the apop_mcmc_proposal_s struct for details.

int apop_mcmc_settings::reject_count

After calling apop_model_metropolis, this will have the number of rejected proposals.

char apop_mcmc_settings::start_at

If '1' (the default), start with a first proposal of all 1s. Even when this is a far-from-useful starting point, MCMC typically does a good job of crawling to better spots early in the chain.
The default when this is unset is to start at the parameters of the apop_model sent in to apop_model_metropolis.

double apop_mcmc_settings::target_accept_rate

The desired acceptance rate, for use by adaptive proposals. Default: .35