NcmFitESMCMCWalker

NcmFitESMCMCWalker — Ensemble sampler Markov Chain Monte Carlo walker class.

Functions

Properties

guint nparams Read / Write / Construct
guint size Read / Write / Construct

Types and Values

Object Hierarchy

    GObject
    ╰── NcmFitESMCMCWalker
        ├── NcmFitESMCMCWalkerAPES
        ├── NcmFitESMCMCWalkerStretch
        ╰── NcmFitESMCMCWalkerWalk

Description

Abstract class for implementing walkers for NcmFitESMCMC.

This class provides the tools to construct the walkers used to generate a Monte Carlo Markov Chain using an ensemble sampler. The objects of this class shall be implemented in the NcmFitESMCMC class, which will generate the MCMC sample. Below, there is a small review about an ensemble sampler and the walker features. For more information about ensemble samplers, check [Ensemble Samplers With Affine Invariance, Jonathan Goodman and Jonathan Weare].

A Monte Carlo Markov Chain (MCMC) is an algorithm method to sample from probability distributions without having to sample directly from the distribution. Suppose that we want to generate a sample from an $n$-dimensional distribution $\pi(X)$. If the function is complicated enough, it is not an easy task to compute the inverse and the norm of the distribution to sample from it, and that is when the MCMC method may be used.

The MCMC method consists of a point proposal $Y$ based on a kernel $K(Y|X)$, which depends on a step proposal and in an acceptance probability $A(Y|X)$, such that the accepted points are distributed by the target distribution $\pi(X)$. This process of proposing one point in a time $t$ and acceptance or rejection based on the distribution may be viewed as one walker. The ensemble sampler is defined as \begin{align} \label{eq2.1} \vec{X}&\equiv(X_1,X_2,X_3,...,X_L) ,\end{align} where $X_i \in \mathbb{R}^{n}$ is called a walker and $\vec{X} \in \mathbb{R}^{Ln}$. The process now consists in proposing points for all the walkers in a time $t$ to a new point in $t+1$, using the information from the other walkers. The ensemble considers the position of the remaining walkers when moving each particular walker, which is the advantage of this method when comparing it to single walker algorithms since this feature leads to faster convergences. The desired target joint distribution of the ensemble is one that let the walkers be independent of each other, such that each walker has the desired target distribution $\pi(X)$, that is, \begin{align} \label{eq2.2} \Pi(\vec{X})=\prod_{i}^{L}\pi(X_i) .\end{align}

Functions

ncm_fit_esmcmc_walker_ref ()

NcmFitESMCMCWalker *
ncm_fit_esmcmc_walker_ref (NcmFitESMCMCWalker *walker);

Increases the reference count of walker atomically.

Parameters

walker

a NcmMSetCatalog

 

Returns

walker .

[transfer full]


ncm_fit_esmcmc_walker_free ()

void
ncm_fit_esmcmc_walker_free (NcmFitESMCMCWalker *walker);

Decreases the reference count of walker atomically.

Parameters

walker

a NcmFitESMCMCWalker

 

ncm_fit_esmcmc_walker_clear ()

void
ncm_fit_esmcmc_walker_clear (NcmFitESMCMCWalker **walker);

Decreases the reference count of *walker atomically and sets the pointer *walker to null.

Parameters

walker

a NcmFitESMCMCWalker

 

ncm_fit_esmcmc_walker_set_size ()

void
ncm_fit_esmcmc_walker_set_size (NcmFitESMCMCWalker *walker,
                                guint size);

Sets the walker's size.

[virtual set_size]

Parameters

walker

a NcmMSetCatalog

 

size

new walker's size

 

ncm_fit_esmcmc_walker_get_size ()

guint
ncm_fit_esmcmc_walker_get_size (NcmFitESMCMCWalker *walker);

[virtual get_size]

Parameters

walker

a NcmMSetCatalog

 

Returns

the size of the walker .


ncm_fit_esmcmc_walker_set_nparams ()

void
ncm_fit_esmcmc_walker_set_nparams (NcmFitESMCMCWalker *walker,
                                   guint nparams);

Sets the number parameters of the walker.

[virtual set_nparams]

Parameters

walker

a NcmMSetCatalog

 

nparams

number of parameters

 

ncm_fit_esmcmc_walker_get_nparams ()

guint
ncm_fit_esmcmc_walker_get_nparams (NcmFitESMCMCWalker *walker);

[virtual get_nparams]

Parameters

walker

a NcmMSetCatalog

 

Returns

the nparams of the walker .


ncm_fit_esmcmc_walker_setup ()

void
ncm_fit_esmcmc_walker_setup (NcmFitESMCMCWalker *walker,
                             NcmMSet *mset,
                             GPtrArray *theta,
                             GPtrArray *m2lnL,
                             guint ki,
                             guint kf,
                             NcmRNG *rng);

Setup the walkers ki to kf (kf not included).

[virtual setup]

Parameters

walker

a NcmMSetCatalog

 

mset

a NcmMSet

 

theta

array of walkers positions.

[element-type NcmVector]

m2lnL

array of walkers $-2\ln(L)$.

[element-type NcmVector]

ki

first walker index

 

kf

last walker index

 

rng

a NcmRNG

 

ncm_fit_esmcmc_walker_step ()

void
ncm_fit_esmcmc_walker_step (NcmFitESMCMCWalker *walker,
                            GPtrArray *theta,
                            GPtrArray *m2lnL,
                            NcmVector *thetastar,
                            guint k);

Move the k -th walker and assign the new position in thetastar .

[virtual step]

Parameters

walker

a NcmMSetCatalog

 

theta

array of walkers positions.

[element-type NcmVector]

m2lnL

array of walkers $-2\ln(L)$.

[element-type NcmVector]

thetastar

a NcmVector

 

k

index of the walker to move

 

ncm_fit_esmcmc_walker_prob ()

gdouble
ncm_fit_esmcmc_walker_prob (NcmFitESMCMCWalker *walker,
                            GPtrArray *theta,
                            GPtrArray *m2lnL,
                            NcmVector *thetastar,
                            guint k,
                            const gdouble m2lnL_cur,
                            const gdouble m2lnL_star);

Calculates the transition probability

[virtual prob]

Parameters

walker

a NcmMSetCatalog

 

theta

array of walkers positions.

[element-type NcmVector]

m2lnL

array of walkers $-2\ln(L)$.

[element-type NcmVector]

thetastar

a NcmVector

 

k

index of the walker to move

 

m2lnL_cur

current value of $-2\ln(L)$

 

m2lnL_star

proposed value for $-2\ln(L^\star)$

 

Returns

the transition probability.


ncm_fit_esmcmc_walker_prob_norm ()

gdouble
ncm_fit_esmcmc_walker_prob_norm (NcmFitESMCMCWalker *walker,
                                 GPtrArray *theta,
                                 GPtrArray *m2lnL,
                                 NcmVector *thetastar,
                                 guint k);

Calculates the transition probability norm, this method is used in the MPI implementation.

[virtual prob_norm]

Parameters

walker

a NcmMSetCatalog

 

theta

array of walkers positions.

[element-type NcmVector]

m2lnL

array of walkers $-2\ln(L)$.

[element-type NcmVector]

thetastar

a NcmVector

 

k

index of the walker to move

 

Returns

the transition probability log-norm.


ncm_fit_esmcmc_walker_clean ()

void
ncm_fit_esmcmc_walker_clean (NcmFitESMCMCWalker *walker,
                             guint ki,
                             guint kf);

Cleanup after moving walkers from ki to kf (kf not included).

[virtual clean]

Parameters

walker

a NcmMSetCatalog

 

ki

first walker index

 

kf

last walker index

 

ncm_fit_esmcmc_walker_desc ()

const gchar *
ncm_fit_esmcmc_walker_desc (NcmFitESMCMCWalker *walker);

[virtual desc]

Parameters

walker

a NcmMSetCatalog

 

Returns

walker description.

[transfer none]

Types and Values

NCM_TYPE_FIT_ESMCMC_WALKER

#define NCM_TYPE_FIT_ESMCMC_WALKER (ncm_fit_esmcmc_walker_get_type ())

struct NcmFitESMCMCWalkerClass

struct NcmFitESMCMCWalkerClass {
};

NcmFitESMCMCWalker

typedef struct _NcmFitESMCMCWalker NcmFitESMCMCWalker;

Property Details

The “nparams” property

  “nparams”                  guint

Number of parameters.

Owner: NcmFitESMCMCWalker

Flags: Read / Write / Construct

Allowed values: >= 1

Default value: 1


The “size” property

  “size”                     guint

Number of walkers.

Owner: NcmFitESMCMCWalker

Flags: Read / Write / Construct

Allowed values: >= 1

Default value: 100