Global sampler
Link to the source files:
Path
The path.jl file exports a type Path and a few functions that apply on such an object.
A Path object encapsulates
xsa matrix of size $p \times N_e$ where $p$ is the dimension and $N_e$ are the number of events recordedtsa vectof of times associated with the eventspthe dimensionnsegthe number of segments
Auxiliary type
The type Segment is useful to encapsulate the information contained between two events. It contains:
ta,tbthe times at the two eventsxa,xbthe positionstau(implicit) the travel time corresponding to the segment or $(t_b-t_a)$v(implicit) the velocity along the segment
Auxiliary functions
getsegmentretrieves a segment starting at timePath.ts[j]samplepathtakes a time or a list of times and returns the position along thePathobject at those timesquadpathpolydoes a simple analytical integration along the path for simple test functions of the form $\varphi(x)=P(x)$ where $P$ is a polynomial (for each dimension)pathmeancomputes the mean usingquadpathpolywhere the polynomial is just $x$esspathcomputation of the ESS corresponding to a number of samples equally spaced along the path. It tries to achieve a specific ratio and increases the number of samples until it achieves it.
Simulate
The simulate.jl file is the main file for the Global Sampler. It contains one main immutable object which contains all of the parameters of the simulation. This is convenient if multiple parameters need to be tested.
A number of default parameters are pre-encoded but some parameters are essential (starting point, starting velocity, etc).
Simulate function
This function should mimic rather closely the original paper. Note in the main loop:
tau = min(bounce.tau, taubd, tauref)corresponds to finding which action needs to be executed (normal bounce, boundary bounce or refreshment). After this one of three branches is executed:
if tau==bounce.tau
...
elseif tau==taubd
...
else
...
endThe first branch corresponds to a bounce against the level set of the log-likelihood, the second to a boundary bounce and third a refreshment.
In the first branch, an explicit call to bounce.dobounce checks whether to thin the event or not. If the time is accepted then the velocity is refreshed otherwise the whole loop is ignored.