The Bouncy Particle Sampler: A Non-Reversible Rejection-Free Markov Chain Monte Carlo Method

Alexandre Bouchard-Côté, Sebastian J. Vollmer, Arnaud Doucet

Introduction

However, the implementation of the BPS proposed in is not applicable to most target distributions arising in statistics. In this article we make the following contributions:

by reformulating explicitly the bounces times of the BPS as the first arrival times of inhomogeneous Poisson Processes (PP), we leverage standard sampling techniques [8, Chapter 6] and methods from chemical kinetics to obtain new computationally efficient ways to simulate the BPS process for a large class of target distributions.

when the target distribution can be expressed as a factor graph , a representation generalizing graphical models where the target is given by a product of factors and each factor can be a function of only a subset of variables, we adapt a physical multi-particle system method discussed in [27, Section III] to achieve additional computational efficiency. This local version of the BPS only manipulates a restricted subset of the state components at each bounce but results in a change of all state components, not just the one being updated contrary the Gibbs sampler.

we present a proof of the ergodicity of BPS when the velocity of the particle is additionally refreshed at the arrival times of an homogeneous PP. When this refreshment step is not carried out, we exhibit a counter-example where ergodicity does not hold.

we propose alternative refreshment schemes and compare their computational efficiency experimentally.

Empirically, these new MCMC schemes compare favorably to state-of-the-art MCMC methods on various Bayesian inference problems, including for high-dimensional scenarios and large data sets. Several additional original extensions of the BPS including versions of the algorithm which are applicable to mixed continuous-discrete distributions, distributions restricted to a compact support and a method relying on the use of curved dynamics instead of straight lines can be found in . For brevity, these are not discussed here.

The rest of this article is organized as follows. In Section 2, we introduce the basic version of the BPS, propose original ways to implement it and prove its ergodicity under weak assumptions. Section 3 presents a modification of the basic BPS which exploits a factor graph representation of the target distribution and develops computationally efficient implementations of this scheme. In Section 4, we demonstrate this methodology on various Bayesian models. The proofs are given in the Appendix and the Supplementary Material.

The bouncy particle sampler

2 Algorithm description

When the particle bounces, its velocity is updated in the same way as a Newtonian elastic collision on the hyperplane tangential to the gradient of the energy. Formally, the velocity after bouncing is given by

3 Algorithms for bounce time simulation

Implementing BPS requires sampling the first arrival time τ\tau of a one-dimensional inhomogeneous PP Π\Pi of intensity χ(t)=λ(x+vt,v)\chi(t)=\lambda(x+vt,v) given by (1). Simulating such a process is a well-studied problem; see [8, Chapter 6, Section 1.3]. We review here three methods and illustrate how they can be used to implement BPS for examples from Bayesian statistics. The first method described in Section 2.3.1 will be particularly useful when the target is log-concave, while the two others described in Section 2.3.2 and Section 2.3.3 can be applied to more general scenarios.

If we let Ξ(t)=∫0tχ(s)ds\varXi\left(t\right)=\int_{0}^{t}\chi\left(s\right){\rm d}s, then the PP Π\Pi satisfies

and therefore τ\tau can be simulated from a uniform variate V∼U(0,1)V\sim\mathcal{U}\left(0,1\right) via the identity

where Ξ−1\varXi^{-1} denotes the quantile function of Ξ,\varXi, \varXi^{-1}(p)=\inf\mbox{\left\{t:p\leq\varXi(t)\right\}}. Refer to Figure 1, top right for a graphical illustration. This identity corresponds to the method proposed in to determine the bounce times and is also used in to simulate related processes.

In general, it is not possible to obtain an analytical expression for τ\tau. However, when the target distribution is strictly log-concave and differentiable, it is possible to solve Equation (5) numerically (see Example 1 below).

Log-concave densities. If the energy is strictly convex (see Figure 1, bottom right), we can minimize it along the line specified by (x,v)(x,v)

where τ∗\tau_{*} is well defined and unique by strict convexity. On the interval [0,τ∗)\left[0,\tau_{*}\right), which might be empty, we have dU(x+vt)/dt<0{\rm d}U\left(x+vt\right)/{\rm d}t<0 and dU(x+vt)/dt≥0{\rm d}U\left(x+vt\right)/{\rm d}t\geq 0 on \left[\tau_{*},\text{\infty}\right). The solution τ\tau of (5) is thus necessarily such that τ≥τ∗\tau\geq\tau_{*} and (5) can be rewritten using the gradient theorem as

Even if we only compute UU pointwise through a black box, we can solve (6) through line search within machine precision.

We note that (6) also provides an informal connection between the BPS and MH algorithms. Exponentiating this equation, we get indeed

Hence, in the log-concave case, and when the particle is climbing the energy ladder (i.e., τ∗=0\tau_{*}=0), BPS can be viewed as “swapping” the order of the steps taken by the MH algorithm. In the latter, we first sample a proposal and second sample a uniform VV to perform an accept-reject decision. With BPS, VV is first drawn then the maximum distance allowed by the same MH ratio is travelled. As for the case of a particle going down the energy ladder, the behavior of BPS is simpler to understand: bouncing never occurs. We illustrate this method for Gaussian distributions.

Multivariate Gaussian distributions. Let U(x)=∥x∥2U\left(x\right)=\left\|x\right\|^{2}, then simple calculations yield

3.2 Simulation using adaptive thinning

When it is difficult to solve (5), the use of an adaptive thinning procedure provides an alternative. Assume we have access to local-in-time upper bounds χˉs(t)\bar{\chi}{}_{s}\left(t\right) on χ(t)\chi(t), that is

where △\triangle is a positive function (standard thinning corresponds to Δ=+∞\Delta=+\infty). Assume additionally that we can simulate the first arrival time of the PP Πˉs\bar{\Pi}_{s} with intensity χˉs(t)\bar{\chi}_{s}(t). Such bounds can be constructed based on upper bounds on directional derivatives of UU provided the remainder of the Taylor expansion can be controlled. Algorithm 2 shows the pseudocode for the adaptive thinning procedure.

The case V>{χ(τ)/χˉs(τ)}V>\{\chi\left(\tau\right)/\bar{\chi}_{s}\left(\tau\right)\} corresponds to a rejection step in the thinning algorithm but, in contrast to rejection steps that occur in standard MCMC samplers, in the BPS algorithm this means that the particle does not bounce and just coasts. Practically, we would like ideally △\triangle and the ratio χ(τ)/χˉs(τ)\chi\left(\tau\right)/\bar{\chi}_{s}\left(\tau\right) to be large. Indeed this would avoid having to simulate too many candidate events from Πˉs\bar{\Pi}_{s} which would be rejected as these rejection steps incur a computational cost.

3.3 Simulation using superposition and thinning

Assume that the energy can be decomposed as

where χ[j](t)=max⁡(0,⟨∇U[j](x+tv),v⟩)\chi^{[j]}(t)=\max\left(0,\left\langle\nabla U^{[j]}(x+tv),v\right\rangle\right) for j=1,...,mj=1,...,m. It is therefore possible to use the thinning algorithm of Section 2.3.2 with χˉ0(t)=∑j=1mχ[j](t)\bar{\chi}_{0}(t)=\sum_{j=1}^{m}\chi^{[j]}\left(t\right) for t≥0t\geq 0 (and Δ=+∞\Delta=+\infty), as we can simulate from Πˉ0\bar{\Pi}_{0} via superposition by simulating the first arrival time τ[j]\tau^{[j]} of each PP with intensity χ[j](t)≥0\chi^{[j]}\left(t\right)\geq 0 then returning

Exponential families. Consider a univariate exponential family with parameter xx, observation y,y, sufficient statistic ϕ(y)\phi(y) and log-normalizing constant A(x)A(x). If we assume a Gaussian prior on x,x, we obtain

The time τ\tau^{} is computed analytically in Example 1 whereas the times τ\tau^{} and τ\tau^{} are given by

Using the superposition and thinning method (Section 2.3.3), simulation of the bounce times can be broken into subproblems corresponding to R+1R+1 factors: one factor coming from the prior, with corresponding energy

and RR factors coming from the likelihood of each datapoint, with corresponding energy

Simulation of τ[R+1]\tau^{[R+1]} is covered in Example 1. Simulation of τ[r]\tau^{[r]} for r∈{1,2,…,R}r\in\left\{1,2,\dots,R\right\} can be approached using thinning. In Appendix C.1, we show that

Since the bound is constant for a given vv, we sample τ[r]\tau^{[r]} by simulating an exponential random variable.

4 Estimating expectations

see, e.g., . When φ(x)=xk\varphi\left(x\right)=x_{k}, k∈{1,2,…,d}k\in\left\{1,2,\dots,d\right\}, we have

When the above integral is intractable, we may just discretize x(t)x\left(t\right) at regular time intervals to obtain an estimator

where δ>0\delta>0 is the mesh size and L=1+⌊T/δ⌋L=1+\left\lfloor T/\delta\right\rfloor. Alternatively, we could approximate these univariate integrals through quadrature.

5 Theoretical results

If we add the condition λref>0{{\lambda^{\text{ref}}}}>0, we get the following stronger result.

The local bouncy particle sampler

In numerous applications, the target distribution admits some structural properties that can be exploited by sampling algorithms. For example, the Gibbs sampler takes advantage of conditional independence properties. We present here a “local” version of the BPS introduced in [27, Section III] which can similarly exploit these properties and, more generally, any representation of the target density as a product of positive factors

where xfx_{f} is a restriction of xx to a subset N_{f}\subseteq\mbox{\lx@text@lbrace 1,2,\dots,,d\}} of the components of xx, and FF is an index set called the set of factors. Hence the energy associated to π\pi is of the form

with ∂Uf(x)/∂xk=0\partial U_{f}\left(x\right)/\partial x_{k}=0 for any variable absent from factor ff, i.e. for any k∈{1,2,…,d}\Nfk\in\left\{1,2,\dots,d\right\}\backslash N_{f}.

Such a factorization of the target density can be formalized using factor graphs (Figure 2, top). A factor graph is a bipartite graph, with one set of vertices NN called the variables, each corresponding to a component of xx (∣N∣=d|N|=d), and a set of vertices FF corresponding to the local factors (γf)f∈F\left(\gamma_{f}\right)_{f\in F}. There is an edge between k∈Nk\in N and f∈Ff\in F if and only if k∈Nf.k\in N_{f}. This representation generalizes undirected graphical models [32, Chap. 2, Section 2.1.3] as, for example, factor graphs can have distinct factors connected to the same set of components (i.e. f≠f′f\neq f^{\prime} with Nf=Nf′N_{f}=N_{f^{\prime}}) as in the example of Section 4.6.

2 Local BPS: algorithm description

Similarly to the Gibbs sampler, each step of the local BPS manipulates only a subset of the dd components of xx. Contrary to the Gibbs sampler, the local BPS does not require sampling from any full conditional distribution and each local calculation results in a change of all state components, not just the one being updated—how this can be done implicitly without manipulating the full state at each iteration is described below. Related processes exhibiting similar characteristics have been proposed in .

We can check that Rf(x)R_{f}\left(x\right) satisfies

We define a collection of PP intensities based on the previous event position x(i−1)x^{(i-1)} and velocity v(i−1)v^{(i-1)}: χf(t)=λf(x(i−1)+v(i−1)t,v(i−1))\chi_{f}(t)=\lambda_{f}(x^{\left(i-1\right)}+v^{\left(i-1\right)}t,v^{\left(i-1\right)}). In the local BPS, the next bounce time τ\tau is the first arrival of a PP with intensity χ(t)=∑f∈Fχf(t)\chi(t)=\sum_{f\in F}\chi_{f}(t). However, instead of modifying all velocity variables at a bounce as in the basic BPS, we sample a factor ff with probability χf(τ)/χ(τ)\chi_{f}(\tau)/\chi(\tau) and modify only the variables connected to the sampled factor. More precisely, the velocity vfv_{f} is updated using Rf(xf)R_{f}\left(x_{f}\right) defined in (18). A generalization of the proof of Proposition 1 given in the Supplementary Material shows that the local BPS algorithm results in a π−\pi-invariant kernel. In the next subsection, we describe various computationally efficient procedures to simulate this process.

For all these implementations, it is useful to encode trajectories in a sparse fashion: each variable k∈Nk\in N only records information at the times tk(1),tk(2),…t_{k}^{(1)},t_{k}^{(2)},\dots where an event (a bounce or refreshment) affected it. By (19), this represents a sublist of the list of all event times. At each of those times tk(i),t_{k}^{(i)}, the component’s position xk(i)x_{k}^{(i)} and velocity vk(i)v_{k}^{(i)} right after the event is stored. Let LkL_{k} denote a list of triplets (xk(i),vk(i),tk(i))i≥0(x_{k}^{(i)},v_{k}^{(i)},t_{k}^{(i)})_{i\geq 0}, where xk(0)x_{k}^{(0)} and vk(0)v_{k}^{(0)} denote the initial position and velocity and tk(0)=0t_{k}^{(0)}=0 (see Figure 2, where the black dots denote the set of recorded triplets). This list is sufficient to compute xk(t)x_{k}(t) for t≤tk(∣Lk∣+1)t\leq t_{k}^{(|L_{k}|+1)}. This procedure is detailed in Algorithm 3 and an example is shown in Figure 2, where the black square on the first variable’s trajectory shows how Algorithm 3 reconstructs x1(t)x_{1}(t) at a fixed time tt: it identifies i(t,1)=3i(t,1)=3 as the index associated to the largest event time t1(3)t_{1}^{(3)} before time tt affecting x1x_{1} and return x1(t)=x1(3)+v1(3)(t−t1(3))x_{1}\left(t\right)=x_{1}^{(3)}+v_{1}^{(3)}(t-t_{1}^{(3)}).

3 Local BPS: efficient implementations

We can sample arrivals from a PP with intensity χ(t)=∑f∈Fχf(t)\chi(t)=\sum_{f\in F}\chi_{f}(t) using the superposition method of Section 2.3.3, the thinning step therein being omitted. To implement this technique efficiently, we store potential future bounce times (called “candidates”) tft_{f}, one for each factor, in a priority queue QQ: only a subset of these candidates will join the lists LkL_{k} which store past, “confirmed” events. We pick the the smallest time in QQ to determine the next bounce time and the next factor ff to modify. The priority queue structure ensures that finding the minimum element of QQ or inserting/updating an element of QQ can be performed with computational complexity O(log⁡∣F∣)O(\log|F|). When a bounce occurs, a key observation behind efficient implementation of the local BPS is that not all the other candidate bounce times need to be resimulated. Suppose that the bounce was associated with factor ff. In this case, only the candidate bounce times tf′t_{f^{\prime}} corresponding to factors f′f^{\prime} with Nf′∩Nf≠∅N_{f^{\prime}}\cap N_{f}\neq\emptyset need to be resimulated. For example, consider the first bounce in Figure 2 (shown in purple), which is triggered by factor faf_{\text{a}} (rectangles represent candidate bounce times tft_{f}; dashed lines connect bouncing factors to the variables that undergo an associated velocity change). Then only the velocities for the variables x1x_{1} and x2x_{2} need to be updated. Therefore, only the candidate bounce times for factors faf_{\text{a}} and fbf_{\text{b}} need to be re-simulated while the candidate bounce time for fcf_{\text{c}} stays constant (this is shown by an exclamation mark in Figure 2).

The method is detailed in Algorithm 4. Several operations of the BPS such as step 4, 6.iii, 6.iv and 7.ii can be easily parallelized.

3.2 Implementation via thinning

When the number of factors involved in Step 6(d)iv is large, the previous queue-based implementation can be computationally expensive. Implementing the local BPS in this setup is closely related to the problem of simulating stochastic chemical kinetics and innovative solutions have been proposed in this area. We adapt here the algorithm proposed in to the local BPS context. For ease of presentation, we present the algorithm without refreshment and only detail the simulation of the bounce times. This algorithm relies on the ability to compute local-in-time upper bounds on λf\lambda_{f} for all f∈Ff\in F. More precisely, we assume that given a current position xx and velocity vv, and Δ∈(0,∞]\Delta\in(0,\infty], we can find a positive number χˉf\bar{\chi}_{f}, such that for any t∈[0,Δ)t\in[0,\Delta), we have χˉf≥λf(x+vt,v)\bar{\chi}_{f}\geq\lambda_{f}(x+vt,v). We can also use this method on a subset GG of FF and combine it with the previously discussed techniques to sample candidate bounce times for factors in FF\GG but we restrict ourselves to G=FG=F to simplify the presentation.

Algorithm 6 will be particularly useful in scenarios where summing over the bounds (Step 5a) and sampling a factor (Step 5(c)ii) can be performed efficiently. A scenario where it is possible to implement these two operations in constant time is detailed in Section 4.6. Another scenario where sampling quickly from F\mathcal{F} is feasible is if the number of distinct upper bounds is much smaller than the number of factors. For example, we only need to sample a factor F\mathcal{F} uniformly at random if Λ=χˉf=χˉf′\Lambda=\bar{\chi}_{f}=\bar{\chi}_{f^{\prime}} for all f,f′f,f^{\prime} in FF and χˉ=∣F∣⋅Λ\bar{\chi}=\left|F\right|\cdot\Lambda (that is no factor needs to be inspected in order to execute Algorithm 5(c)ii) and the thinning procedure in Step 5(c)iii boils down to

A related approach has been adopted in for the analysis of big data. In this particular scenario, an alternative local BPS can also be implemented where s>1s>1 factors F=(F1,…,Fs)\mathcal{F}=\left(\mathcal{F}_{1},\dots,\mathcal{F}_{s}\right) are sampled uniformly at random without replacement from FF, the thinning occurs with probability

and the components of xx belonging to NFN_{\mathcal{F}} bounce based on ∑j=1s∇UFj(x)\sum_{j=1}^{s}\nabla U_{\mathcal{F}_{j}}(x). One can check that the resulting dynamics preserves π\pi as an invariant distribution. In contrast to s=1s=1, this is not an implementation of local BPS described in Algorithm 6, but instead this corresponds to a local BPS update for a random partition of the factors.

Numerical results

We consider an isotropic multivariate Gaussian target distribution, U(x)=∥x∥2U\left(x\right)=\left\|x\right\|^{2}, to illustrate the need for refreshment. Without refreshment, we obtain from Equation (7)

In this scenario, we show that BPS without refreshment admits a countably infinite collection of invariant distributions. Let us define r(t)=∥x(t)∥r\left(t\right)=\left\|x\left(t\right)\right\| and m(t)=⟨x(t),v(t)⟩/∥x(t)∥m\left(t\right)=\left\langle x\left(t\right),v\left(t\right)\right\rangle/\left\|x\left(t\right)\right\| and denote by χk\chi_{k} the probability density of the chi distribution with kk degrees of freedom.

For any dimension d≥2d\geq 2, the process (r(t),m(t))t≥0\left(r\left(t\right),m\left(t\right)\right)_{t\geq 0} is Markov and its transition kernel is invariant with respect to the probability densities {fk(r,m)∝χk(2r)⋅(1−m2)(k−3)/2;k∈{2,3,…}}\left\{f_{k}(r,m)\propto\chi_{k}(\sqrt{2}r)\cdot(1-{{m}}^{2})^{(k-3)/2};k\in\left\{2,3,\ldots\right\}\right\}.

Next, we look at the scaling of the Effective Sample Size (ESS) per CPU second of the basic BPS algorithm for φ(x)=x1\varphi\left(x\right)=x_{1} when λref=1\lambda_{\text{ref}}=1 as the dimension dd of the isotropic normal target increases. The ESS is estimated using the R package mcmcse by evaluating the trajectory on a fine discretization of the sampled trajectory. The results in log-log scale are displayed in Figure 3. The curve suggests a decay of roughly d−1.47d^{-1.47}, slightly inferior to the d−1.25d^{-1.25} scaling for an optimally tuned Hamiltonian Monte Carlo (HMC) algorithm [6, Section III], [24, Section 5.4.4]. It should be noted that BPS achieves this scaling without varying any tuning parameter, whereas HMC’s performance critically depends on tuning two parameters (leap-frog stepsize and number of leap-frog steps). Both BPS and HMC compare favorably to the d−2d^{-2} scaling of the optimally tuned random walk MH .

2 Comparison of the global and local schemes

We compare the basic “global” BPS of Section 2 to the local BPS of Section 3 on a sparse Gaussian field. We use a chain-shaped undirected graphical model of length d=1000d=1000 and perform separate experiments for various pairwise precision parameters for the interaction between neighbors in the chain. Both methods are run for 60 seconds. We compare the Monte Carlo estimate of the variance of x500x_{500} to its true value. The results are shown in Figure 4. The smaller computational complexity per local bounce of the local BPS offsets significantly the associated decrease in expected trajectory segment length. Moreover, both versions appear insensitive to the pairwise precision used in this sparse Gaussian field.

3 Comparisons of alternative refreshment schemes

In Section 2, the velocity was refreshed using a Gaussian distribution. We compare here this global refreshment scheme to three alternatives:

if the local BPS is used, the factor graph structure can be exploited to design computationally cheaper refreshment operators. We pick one factor f∈Ff\in F uniformly at random and resample only the components of vv with indices in NfN_{f}. By the same argument used in Section 3, each refreshment requires bounce time recomputation only for the factors f′f^{\prime} with Nf∩Nf′≠∅N_{f}\cap N_{f^{\prime}}\neq\emptyset.

the velocities are refreshed according to ϕ(v)\phi\left(v\right), the uniform distribution on Sd−1\mathcal{S}^{d-1}, and the BPS admits now ρ(z)=π(x)ϕ(v)\rho\left(z\right)=\pi\left(x\right)\phi\left(v\right) as invariant distribution.

a variant of restricted refreshment where we sample an angle θ\theta by multiplying a Beta(α\alpha, β\beta)-distributed random variable by 2π.2\pi. We then select a vector uniformly at random from the unit length vectors that have an angle θ\theta from vv. We used α=1,β=4\alpha=1,\beta=4 to favor small angles.

One limitation of the results in this section is that the optimal refreshment scheme and refreshment rate will in general be problem dependent. Adaptation methods used in the HMC literature could potentially be adapted to this scenario , but we leave these extensions to future work.

4 Comparisons with HMC methods on high-dimensional Gaussian distributions

Next, we compare the local BPS to NUTS (“adapt=true,fit_metric=true,nuts=true”) as the dimension dd increases. Experiments are performed on the chain-shaped Gaussian Random Field of Section 4.2 with the pairwise precision parameter set to 0.5. We vary the length of the chain (10, 100, 1000), and run Stan’s implementation of NUTS for 1000 iterations + 1000 iterations of adaptation. We measure the wall-clock time (excluding the time taken to compile the Stan program) and then run our method for the same wall-clock time 40 times for each chain size. The absolute value of the relative error averaged on 10 equally spaced marginal variances is measured as a function of the percentage of the total computational budget used; see Figure 7. The gap between the two methods widens as dd increases. To visualize the different behavior of the two algorithms, three marginals of the Stan and BPS paths for d=100d=100 are shown in Figure 8. Contrary to Section 4.1, BPS outperforms here HMC as its local version is able to exploit the sparsity of the random field.

5 Poisson-Gaussian Markov random field

6 Bayesian logistic regression for large data sets

Consider the logistic regression model introduced in Example 3 when the number of data RR is large. In this context, standard MCMC schemes such as the MH algorithm are computationally expensive as they require evaluating the likelihood associated to the RR observations at each iteration. This has motivated the development of techniques which only evaluate the likelihood of a subset of the data at each iteration. However, most of the methods currently available introduce either some non-vanishing asymptotic bias, e.g. the subsampling MH scheme proposed in , or provide consistent estimates converging at a slower rate than regular MCMC algorithms, e.g. the Stochastic Gradient Langevin Dynamics introduced in . The only available algorithm which only requires evaluating the likelihood of a subset of data at each iteration yet provides consistent estimates converging at the standard Monte Carlo rate is the Firefly algorithm .

In this context, we associate R+1R+1 factors to the target posterior distribution: one for the prior and one for each data point with xf=xx_{f}=x for all f∈Ff\in F. As a uniform upper bound on the intensities of these local factors is available for restricted refreshment, see Appendix C.1, we could use (21) in conjunction with Algorithm 6 to provide an alternative to the Firefly algorithm which selects at each bounce a subset of ss data points uniformly at random without replacement. For s=1s=1, a related algorithm has been recently explored in . In presence of outliers, this strategy can be inefficient as the uniform upper bound becomes very large, resulting in a computationally expensive implementation. After a pre-computation step of complexity O(Rlog⁡R)O(R\log R) only executed once, we show here that Algorithm 6 can be implemented using data-dependent bounds mitigating the sensitivity to outliers while maintaining the computational cost of each bounce independent of RR. We first pre-compute the sum of covariates over the data points, ιkc=∑r=1Rιr,k1[yr=c]\iota_{k}^{c}=\sum_{r=1}^{R}\iota_{r,k}{\mathbf{1}}[y_{r}=c], for k∈{1,…,d}k\in\left\{1,\ldots,d\right\} and class label c∈{0,1}c\in\left\{0,1\right\}. Using these quantities, it is possible to compute

with χˉ[r]\bar{\chi}^{[r]} given in (12). If dd is large, we can keep the sum χˉ\bar{\chi} in memory and add-and-subtract any local updates to it. The implementation of Step 5(c)ii relies on the alias method [8, Section 3.4]. A detailed description of these derivations and of the algorithm is presented in Appendix C.

We compare the local BPS with thinning to the MAP-tuned Firefly algorithm implementation provided by the authors. This version of Firefly outperforms experimentally significantly the standard MH in terms of ESS per-datum likelihood . The two algorithms are here compared in terms of this criterion, where the ESS is averaged over the d=5d=5 components of xx. We generate covariates ιrk∼i.i.d.U(0.1,1.1)\iota_{rk}\overset{\text{i.i.d.}}{\sim}\mathcal{U}(0.1,1.1) and data yr∈{0,1}y_{r}\in\{0,1\} for r=1,…,Rr=1,\dots,R according to (9) and set a zero-mean normal prior of covariance σ2Id\sigma^{2}I_{d} for xx. For the algorithm, we set λref=0.5, σ2=1\lambda_{\text{ref}}=0.5,\,\sigma^{2}=1 and Δ=0.5\Delta=0.5, which is the length of the time interval for which a constant upper bound for the rate associated with the prior is used, see Algorithm 7. Experimentally, local BPS always outperforms Firefly, by about an order of magnitude for large data sets. However, we also observe that both Firefly and local BPS have an ESS per datum likelihood evaluation decreasing in approximately 1/R1/R so that the gains brought by these algorithms over a correctly scaled random walk MH algorithm do not appear to increase with RR. The rate for local BPS is slightly superior in the regime of up to 10410^{4} data points, but then returns to the approximate 1/R1/R rate. To improve this rate, one can adapt the control variate ideas introduced in for the MH algorithm to these schemes. This has been proposed in for a related algorithm and in for the local BPS.

7 Bayesian inference of evolutionary parameters

We compare against a state-of-the-art HMC sampler that uses Bayesian optimization to adapt the key parameters of HMC, the leap-frog stepsize and the number of leap-frog steps, while preserving convergence to the target distribution. Both our method and this HMC method are implemented in Java and share the same gradient computation code. Refer to the Supplementary Material for additional background and motivation behind this adaptation method.

We first perform various checks to ensure that both BPS and HMC chains are in close agreement given a sufficiently large number of iterations. After 20 millions HMC iterations, the credible intervals estimates from the HMC method are in close agreement with those obtained from BPS (result not shown) and both methods pass the Geweke diagnostic .

To compare the effectiveness of the two samplers, we look at the ESS per second of the model parameters. We show the maximum, median, and maximum over the 10 parameter components for 10 runs, for both BPS and HMC in Figure 11. We observe a speed-up by a factor two for all statistics considered (maximum, median, minimum). In the supplement, we show that the HMC chain displays much larger autocorrelations than the BPS chain.

Discussion

Most MCMC methods currently available, such as the MH and HMC algorithms, are discrete-time reversible processes. There is a wealth of theoretical results showing that non-reversible Markov processes mix faster and provide lower variance estimates of ergodic averages . However, most of the non-reversible processes studied in the literature are diffusions and cannot be simulated exactly. The BPS is an alternative continuous-time Markov process which, thanks to its piecewise deterministic paths, can be simulated exactly for many problems of interest in statistics.

As any MCMC method, the BPS can struggle in multimodal scenarios and when the target exhibits very strong correlations. However, for a range of applications including sparse factor graphs, large datasets and high-dimensional settings, we have observed empirically that BPS is on par or outperforms state-of-the art methods such as HMC and Firefly. The main practical limitation of the BPS compared to HMC is that its implementation is model-specific and requires more than knowing ∇U\nabla U pointwise. An important open problem is therefore whether its implementation, and in particular the simulation of bouncing times, can be fully automated. However, the techniques described in Section 2.3 are already sufficient to handle many interesting models. There are also numerous potential methodological extensions of the method to study. In particular, it has been shown in how one can exploit the local geometric structure of the target to improve HMC and it would be interesting to investigate how this could be achieved for BPS. More generally, the BPS is a specific continuous-time piecewise deterministic Markov process . This class of processes deserves further exploration as it might provide a whole new class of efficient MCMC methods.

Acknowledgements

Alexandre Bouchard-Côté’s research is partially supported by a Discovery Grant from the National Science and Engineering Research Council. Arnaud Doucet’s research is partially supported by the Engineering and Physical Sciences Research Council (EPSRC), grants EP/K000276/1, EP/K009850/1 and by the Air Force Office of Scientific Research/Asian Office of Aerospace Research and Development, grant AFOSRA/AOARD-144042. Sebastian Vollmer’s research is partially supported by the EPSRC grants EP/K009850/1 and EP/N000188/1. We thank Markus Upmeier for helpful discussions of differential geometry as well as Nicholas Galbraith, Fan Wu, and Tingting Zhao for their comments.

References

Appendix A Proofs of Section 2

The BPS process is a specific piecewise-deterministic Markov process so the expression of its generator follows from [7, Theorem 26.14]. Its adjoint is given in and a derivation of this expression from first principles can be found in the Supplementary Material. To establish the invariance with respect to ρ\rho, we first show that ∫Lh(z)ρ(z)dz=0\mathcal{\int L}h(z)\rho\left(z\right){\rm d}z=0. We have

As ρ(z)=π(x)ψ(v)\rho\left(z\right)=\pi\left(x\right)\psi\left(v\right), the term (24) is trivially equal to zero, while a change-of-variables shows that

as R−1(x)v=R(x)vR^{-1}\left(x\right)v=R\left(x\right)v and∥R(x)v∥=∥v∥\left\|R\left(x\right)v\right\|=\left\|v\right\| implies ψ(R(x)v)=ψ(v)\psi\left(R\left(x\right)v\right)=\psi\left(v\right). Additionally, by integration by parts, we obtain as hh is bounded

Substituting (25) and (26) into (22)-(23)-(24), we obtain

where we have used ⟨∇U(x),R(x)v⟩=−⟨∇U(x),v⟩\left\langle\nabla U(x),R\left(x\right)v\right\rangle=-\left\langle\nabla U(x),v\right\rangle and max⁡{0,−f}−max⁡{0,f}=−f\max\{0,-f\}-\max\{0,f\}=-f for any ff. The result now follows by [7, Proposition 34.7].

A.2 Proof of Theorem 1

We can now define our tractable set and establish its key properties.

Let t>0t>0, and assume the initial point of the BPS, satisfies ∥x0∥≤t\|x_{0}\|\leq t, ∥v0∥≤1\|v_{0}\|\leq 1. If ∥∇U∥∗=sup⁡{∥∇U(x)∥:∥x∥≤3t}\|\nabla U\|^{*}=\sup\left\{\|\nabla U(x)\|:\|x\|\leq 3t\right\} then the event

On the event E\mathscr{E}, we have ∥v(t′)∥≤1\|v(t^{\prime})\|\leq 1 and ∥x(t′)∥≤2t\|x(t^{\prime})\|\leq 2t for all t′∈[0,t]t^{\prime}\in\left[0,t\right],

On the event E\mathscr{E}, there are exactly two refreshments and no bouncing in the interval (0,t)(0,t), i.e. τ1=τ1(ref)\tau_{1}=\tau_{1}^{\text{(ref)}}, τ2=τ2(ref),\tau_{2}=\tau_{2}^{\text{(ref)}}, and τ1+τ2≤t≤τ1+τ2+τ3\tau_{1}+\tau_{2}\leq t\leq\tau_{1}+\tau_{2}+\tau_{3},

vi∣E∼i.i.d.ψ≤1(0,I)v_{i}|\mathscr{E}\overset{\text{i.i.d.}}{\sim}\psi_{\leq 1}(0,I) for i∈{1,2}i\in\left\{1,2\right\}, where ψ≤1\psi_{\leq 1} denotes the truncated Gaussian distribution, with ∥vi∥≤1\|v_{i}\|\leq 1,

(τ1(ref),τ2(ref))∣E∼U({(τ1,τ2)∈(0,t)2:τ1+τ2≤t})\left(\tau_{1}^{\text{(ref)}},\tau_{2}^{\text{(ref)}}\right)|\mathscr{E}\sim\mathcal{U}\left(\left\{(\tau_{1},\tau_{2})\in(0,t)^{2}:\tau_{1}+\tau_{2}\leq t\right\}\right).

To prove Part 1 and 2, we will make use of this preliminary result: on E3,\mathscr{E}_{3}, ∥vi−1∥≤1,∥xi−1∥≤2t\|v_{i-1}\|\leq 1,\|x_{i-1}\|\leq 2t implies τi(bounce)≥t\tau_{i}^{\text{(bounce)}}\geq t for i∈{1,2,3}i\in\left\{1,2,3\right\}. Indeed, ∥vi−1∥≤1\|v_{i-1}\|\leq 1 and ∥xi−1∥≤2t\|x_{i-1}\|\leq 2t imply that χzi−1(t′)≤∥∇U∥∗\chi_{z_{i-1}}(t^{\prime})\leq\|\nabla U\|^{*} for all t′∈[0,t]t^{\prime}\in\left[0,t\right]. It follows that Ξzi−1(t)≤∥∇U∥∗t\Xi_{z_{i-1}}(t)\leq\|\nabla U\|^{*}t. Hence, by the continuity of Ξzi−1\Xi_{z_{i-1}} and standard properties of the quantile function, τi(bounce)=Ξzi−1−1(ei(bounce))≥t\tau_{i}^{\text{(bounce)}}=\Xi_{z_{i-1}}^{-1}(e_{i}^{\text{(bounce)}})\geq t.

Part 1 and 2: by the assumption on x0x_{0} and v0v_{0} and our preliminary result, τ1(bounce)≥t\tau_{1}^{\text{(bounce)}}\geq t, and hence, combining with E1\mathscr{E}_{1} and E2\mathscr{E}_{2} we have τ1=τ1(ref)≤t\tau_{1}=\tau_{1}^{\text{(ref)}}\leq t and ∥v1∥=∥n1∥≤1\|v_{1}\|=\|n_{1}\|\leq 1. Also, by the triangle inequality, ∥x1∥≤∥x0∥+∥x1−x0∥≤t+τ1(ref)≤2t\|x_{1}\|\leq\|x_{0}\|+\|x_{1}-x_{0}\|\leq t+\tau_{1}^{\text{(ref)}}\leq 2t. We can therefore apply our preliminary result again and obtain τ2(bounce)≥t\tau_{2}^{\text{(bounce)}}\geq t, and hence, combining again with E1\mathscr{E}_{1} and E2\mathscr{E}_{2}, we have τ2=τ2(ref)\tau_{2}=\tau_{2}^{\text{(ref)}}, τ1+τ2≤t\tau_{1}+\tau_{2}\leq t, ∥v2∥=∥n2∥≤1\|v_{2}\|=\|n_{2}\|\leq 1. Applying the triangle inequality a second time yields ∥x2∥≤t+τ1(ref)+τ2(ref)≤2t\|x_{2}\|\leq t+\tau_{1}^{\text{(ref)}}+\tau_{2}^{\text{(ref)}}\leq 2t. We apply our preliminary result one last time to obtain τ3(bounce)≥t\tau_{3}^{\text{\text{(bounce)}}}\geq t. Hence, if τ3(ref)>τ3(bounce)\tau_{3}^{\text{(ref)}}>\tau_{3}^{\text{(bounce)}}, τ1+τ2+τ3=τ1(ref)+τ2(ref)+τ3(bounce)≥t\tau_{1}+\tau_{2}+\tau_{3}=\tau_{1}^{\text{(ref)}}+\tau_{2}^{\text{(ref)}}+\tau_{3}^{\text{(bounce)}}\geq t, while if τ3(ref)≤τ3(bounce)\tau_{3}^{\text{(ref)}}\leq\tau_{3}^{\text{(bounce)}}, we can use E1\mathscr{E}_{1} to conclude that τ1+τ2+τ3=τ1(ref)+τ2(ref)+τ3(ref)≥t\tau_{1}+\tau_{2}+\tau_{3}=\tau_{1}^{\text{(ref)}}+\tau_{2}^{\text{(ref)}}+\tau_{3}^{\text{(ref)}}\geq t. It follows from the triangle inequality that ∥x(t′)∥≤2t\|x(t^{\prime})\|\leq 2t for all t′∈[0,t]t^{\prime}\in\left[0,t\right].

Part 3, 4 and 5: these follow straightforwardly from the construction of E\mathscr{E}. ∎

Note that the statement and proof of Part 4 is simple because E3∈σ(ei(bounce):i∈{1,2,3})\mathscr{E}_{3}\in\sigma(e_{i}^{\text{(bounce)}}:i\in\left\{1,2,3\right\}). In contrast, conditioning on conceptually simpler events of the form (τi(bounce)>t)∈σ(ei(bounce),zi−1)(\tau_{i}^{\text{(bounce)}}>t)\in\sigma\left(e_{i}^{\text{(bounce)}},z_{i-1}\right) leads to conditional distributions on vkv_{k} which are harder to characterize.

In the following, BR(x)B_{R}\left(x\right) denotes the dd-dimensional Euclidean ball of radius RR centered at xx.

For all ϵ,t>0\epsilon,t>0 such that ϵ≤t/6\epsilon\leq t/6, and v,v2∈B1(0)v,v_{2}\in B_{1}(0), x,x′∈Bϵ(0)x,x^{\prime}\in B_{\epsilon}(0), 0≤τ1≤t60\leq\tau_{1}\leq\frac{t}{6}, and 2t3≤τ2≤5t6\frac{2t}{3}\leq\tau_{2}\leq\frac{5t}{6}, we have ∥v1∥≤1\left\|v_{1}\right\|\leq 1, where v1v_{1} is defined by:

Using Lemma 1, Parts 4 and 5, we can rewrite the above conditional expectation as:

We will use the coarea formula to reorganize the order of integration, see e.g. Section 3.2 of . We start by introducing some notation.

For C1C^{1} Riemannian manifolds MM and NN of dimension mm and nn, a differentiable map F:M→NF:M\rightarrow N and hh a measurable test function, the coarea formula can be written as:

Here Hm\mathcal{H}_{m}, Hn\mathcal{H}_{n} and Hm−n\mathcal{H}_{m-n} denote the volume measures associated with the Riemannian metric on MM, NN and F−1(u)F^{-1}(u) (with the induced metric of MM). In the above equations, JFJF is a generalization of the determinant of the Jacobian JF:=det⁡g(∇fi,∇fj)JF:=\sqrt{\det g(\nabla f_{i},\nabla f_{j})} where gg is the corresponding Riemannian metric and ff is the representation of FF in local coordinates, see . Here JF\text{=\sqrt{\det DF\,DF^{\top}}} where DFDF is defined in equation (A.2) below.

We apply the coarea formula to M={(τ1,τ2)∈(0,t)2:τ1+τ2≤t}×B1(0)×B1(0)M=\left\{(\tau_{1},\tau_{2})\in(0,t)^{2}:\tau_{1}+\tau_{2}\leq t\right\}\times B_{1}(0)\times B_{1}(0), N=Bt(x)×B1(0)N=B_{t}(x)\times B_{1}(0), F_{z}(\tau_{1},{{v}}_{1},\tau_{2},{\hyperlink{v}{\color[rgb]{0,0,0}{v}}}_{2})=\left(x+\tau_{1}v+\tau_{2}v_{1}+(t-\tau_{1}-\tau_{2})v_{2},v_{2}\right), m=2d+2m=2d+2, n=2dn=2d and obtain:

where p(τ1,τ2)p(\tau_{1},\tau_{2}) denotes the joint conditional density of τ1,τ2∣E\tau_{1},\tau_{2}|\mathscr{E} described in Part 5 of Lemma 1, and:

We define δ′=inf⁡{Iz(z′):z,z′∈B}\delta^{\prime}=\inf\left\{I_{z}(z^{\prime}):z,z^{\prime}\in B\right\}, and obtain the following inequality

It is therefore enough to show that δ′>0\delta^{\prime}>0. To do so, we will derive the following bounds related to the integral in Iz(z′)I_{z}(z^{\prime}):

Its domain of integration Fz−1(z′)F_{z}^{-1}(z^{\prime}) is guaranteed to contain a set of positive H2\mathcal{H}_{2} measure.

Its integrand is bounded below by a strictly positive constant.

To establish 1, we let z′=(x′,v′)=(x′,v2)z^{\prime}=(x^{\prime},v^{\prime})=(x^{\prime},v_{2}), and notice that rearranging

yields an expression for v1v_{1} given in (27). From Lemma 2, it follows that

and H2(Cz(z′))≥(t/6)2\mathcal{H}_{2}(C_{z}(z^{\prime}))\geq(t/6)^{2} since the surface of the graph of a function is larger than the surface of the domain.

To establish 2, we start by analyzing JFzJF_{z}. Exploiting its block structure, we obtain:

Moreover, it follows from basic properties of the truncated Gaussian distribution ψ≤1\psi_{\leq 1} and of p(τ1,τ2)p(\tau_{1},\tau_{2}) that

To prove Part 2 of the lemma, we divide the trajectory of length nt0nt_{0} into three “phases” namely a deceleration, travel, and acceleration phases, or respective lengths td+tt+ta=nt0t_{\text{d}}+t_{\text{t}}+t_{\text{a}}=nt_{0} defined below (see also Supplement for a figure illustrating the notation used in this part of the lemma). This allows us to use Part 1 of the present lemma which requires velocities bounded in norm by one. We require an acceleration phase since WW may not necessarily include velocities of norms bounded by one.

First, we show that we decelerate with positive probability by time td=t0t_{\text{\text{d}}}=t_{0}. Let R\mathscr{R} denote the event that there is exactly one refreshment in the interval (0,t0)(0,t_{0}), and that the refreshed velocity has norm bounded by one. Define also r0=t0max⁡{1,∥v∥}r_{0}=t_{0}\max\left\{1,\|v\|\right\}, which bounds the distance travelled in (0,t0)(0,t_{0}) for outcomes in R\mathscr{R}, since bouncing does not change the norm of the velocity. We have:

Next, to prepare applying the first part of the lemma, set

Informally, ϵ\epsilon is selected so that the ball of radius ϵ\epsilon around the origin contains both any position attained after deceleration, as well as ball around a point x⋆x^{\star} in WW. Indeed, since WW is open and that ϵ>r′\epsilon>r^{\prime}, there exists some r>0,(x⋆,v⋆)∈Wr>0,\left(x^{\star},v^{\star}\right)\in W such that Br(x⋆)×Br(v⋆)⊆WB_{r}(x^{\star})\times B_{r}(v^{\star})\subseteq W and Bϵ(0)⊇Br0(x)∪Br(x⋆)B_{\epsilon}(0)\supseteq B_{r_{0}}(x)\cup B_{r}(x^{\star}). Let also n=2+⌈6ϵt0⌉n=2+\left\lceil\frac{6\epsilon}{t_{0}}\right\rceil .

Of the total time nt0nt_{0}, we reserve time ta=min⁡{t0,(2(∥v⋆∥/r+1))−1,r/2}t_{\text{a}}=\min\left\{t_{0},(2(\|v^{\star}\|/r+1))^{-1},r/2\right\} to accelerate. This time is selected so that (a) t0−ta≥0t_{0}-t_{\text{a}}\geq 0, and (b), if we start with a position in Br/2(x⋆)B_{r/2}(x^{\star}), move with a velocity bounded in norm by vˉ=max⁡{1,∥v⋆∥+r}\bar{v}=\max\left\{1,\|v^{\star}\|+r\right\} for a time Δt≤min⁡{(2(∥v⋆∥/r+1))−1,r/2}\Delta t\leq\min\left\{(2(\|v^{\star}\|/r+1))^{-1},r/2\right\}, we have that the final position is in Br(x⋆)B_{r}(x^{\star}). This holds since the distance travelled is bounded by vˉΔt≤r/2\bar{v}\Delta t\leq r/2. Hence, by a similar argument as used for deceleration, we have, for all z′′∈Br/2(x⋆)×B1(0)z^{\prime\prime}\in B_{r/2}(x^{\star})\times B_{1}(0),

We can now exploit this Lemma to prove Theorem 1.

This contradicts that μi(Ai)=0\mu_{i}(A_{i})=0 for i∈{1,2}i\in\left\{1,2\right\}.

The law of large numbers then follows by Birkhoff’s pointwise ergodic theorem; see e.g. [9, Theorem 2.30, Section 2.6.4]. ∎

Appendix B Proof of Proposition 2

The dynamics of the BPS can be lumped into a two-dimensional Markov process involving only the radius r(t)=∥x(t)∥r\left(t\right)=\left\|x\left(t\right)\right\| and m(t)=⟨x(t),v(t)⟩/∥x(t)∥m\left(t\right)=\left\langle x\left(t\right),v\left(t\right)\right\rangle/\left\|x\left(t\right)\right\| for any dimensionality d≥2d\geq 2. The variable m(t)m\left(t\right) can be interpreted (via arccos⁡(m(t))\arccos(m\left(t\right))) as the angle between the particle position x(t)x\left(t\right) and velocity v(t)v\left(t\right). Because of the strong Markov property we can take τ1=0\tau_{1}=0 without loss of generality and let tt be some time between the current event and the next, yielding:

If there is a bounce at time tt, then r(t)r\left(t\right) is not modified but m(t)=−m(t)m\left(t\right)=-m\left(t\right).The bounce happens with intensity λ(x+tv,v)=max⁡(0,⟨x+vt,v⟩){{\lambda}}(x+tv,v)=\max\left(0,\left\langle x+vt,v\right\rangle\right). These processes can also be written as an Stochastic Differential Equation (SDE) driven by a jump process whose intensity is coupled to its position. This is achieved by writing the deterministic dynamics given in (35) between events as the following Ordinary Differential Equation (ODE):

Taking the bounces into account turns this ODE into an SDE with

where NtN_{t} is the counting process associated with a PP with intensity max⁡(0,r(t)m(t))\max\left(0,r\left(t\right)m\left(t\right)\right).

Now consider the push forward measure of N(0,12Ik)⊗U(Sk−1)\mathcal{N}\left(0,\frac{1}{2}I_{k}\right)\otimes\mathcal{U}(\mathcal{S}^{k-1}) under the map (x,v)↦(∥x∥,⟨x,v⟩/∥x∥)\left(x,v\right)\mapsto\left(\left\|x\right\|,\left\langle x,v\right\rangle/\left\|x\right\|\right) where U(Sk−1)\mathcal{U}(\mathcal{S}^{k-1}) is the uniform distribution on Sk−1\mathcal{S}^{k-1}. This yields the collection of measures with densities fk(r,m)f_{k}(r,m). One can check that fk(r,m)f_{k}(r,m) is invariant for (36) for all k≥2k\geq 2.

Appendix C Bayesian logistic regression for large datasets

We derive here a datapoint-specific upper bound χˉ[r]\bar{\chi}^{[r]} to χ[r](t)\chi^{[r]}(t). First, we need to compute the gradient for one datapoint:

We then consider two sub-cases depending on yr=0y_{r}=0 or yr=1y_{r}=1. Suppose first yr=0y_{r}=0, and let x(t)=x+tvx(t)=x+tv

When implementing Algorithm 6, we need to bound ∑r=1Rχ[r](t)\sum_{r=1}^{R}\chi^{[r]}(t). We have

The bound χˉ\bar{\chi} is constant between bounce events and only depends on the magnitude of vv. If we further assume that we use restricted refreshment then this bound is valid for any t>0t>0 allowing us to implement Algorithm 6 using (20) or (21).

C.2 Sampling the thinned factor

We show here how to implement Step 5(c)ii of Algorithm 6 without enumerating over the RR datapoints. We begin by introducing some required pre-computed data structures. The pre-computation is executed only once at the beginning of the algorithm, so its running time, O(Rlog⁡R)O(R\log R) is considered negligible (the number of bouncing events is assumed to be greater than RR). For each dimensionality kk and class label cc, consider the categorical distribution with the following probability mass function over the datapoints:

This is just the distribution over the datapoints that have the given label, weighted by the covariate kk. An alias sampling data-structure [8, Section 3.4] is computed for each kk and cc. This pre-computation takes total time O(Rlog⁡R)O(R\log R). This allows subsequently to sample in time O(1)O(1) from the distributions μk(c)\mu_{k}^{(c)}.

We now show how this pre-computation is used to to implement Step 5(c)ii of Algorithm 6. We denote the probability mass function we want to sample from by

To sample this distribution efficiently, we construct an artificial joint distribution over both datapoints and covariate dimension indices

We denote by qk(k)q_{\textrm{k}}(k), respectively qr∣k(r∣k)q_{\textrm{r}|\textrm{k}}(r|k), the associated marginal, respectively conditional distribution. By construction, we have

It is therefore enough to sample (r,k)(r,k) and to return rr. To do so, we first sample (a) k∼qk(⋅)k\sim q_{\textrm{k}}(\cdot) and then (b) sample r∣k∼qr∣k(⋅∣k)r|k\sim q_{\textrm{r}|\textrm{k}}(\cdot|k).

so this sampling step again does not require looping over the datapoints thanks the pre-computations described earlier.

and therefore this sampling step can be computed in O(1)O(1) thanks to the pre-computed alias sampling data structure.

C.3 Algorithm description

Algorithm 7 contains a detailed implementation of the local BPS with thinning for the logistic regression example (Example 4.6).

Supplemental Material: The Bouncy Particle Sampler A Non-Reversible Rejection-Free Markov Chain Monte Carlo Method

Appendix D Illustration for Lemma 3

The following figure illustrates the different phases considered in the proof of Lemma 3.

Appendix E Direct proof of invariance

Let μt\mu_{t} be the law of z(t)z\left(t\right). In the following, we prove invariance by explicitly verifying that the time evolution of the density dμtdt=0\frac{{\rm d}\mu_{t}}{{\rm d}t}=0 is zero if the initial distribution μ0\mu_{0} is given by ρ(z)=π(x)ψ(v)\rho(z)=\pi\left(x\right)\psi\left(v\right) in Proposition 1. This is achieved by deriving the forward Kolmogorov equation describing the evolution of the marginal density of the stochastic process. For simplicity, we start by presenting the invariance argument when λref=0\lambda^{\text{{ref}}}=0.

It follows that the probability of having no bounce in the interval [0,t][0,t] is given by:

and the density of the random variable T1T_{1} is given by:

If a bounce occurs, then the algorithm follows a translation path for time T1T_{1}, at which point the velocity is updated using a bounce operation C(z)C(z), defined as:

The algorithm then continues recursively for time t−T1t-T_{1}, in the following sense: a second bounce time T2T_{2} is simulated by adding to T1T_{1} a random increment with density q(⋅;C∘Φt1(z))q(\cdot;C\circ\Phi_{t_{1}}(z)). If T2>tT_{2}>t, then the output of the algorithm is Φt−t1∘C∘Φt1(z)\Phi_{t-t_{1}}\circ C\circ\Phi_{t_{1}}(z), otherwise an additional bounce is simulated, etc. More generally, given an initial point zz and a sequence t=(t1,t2,… )\mathbf{t}=(t_{1},t_{2},\dots) of bounce times, the output of the algorithm at time tt is given by:

where ( )(\thinspace) denotes the empty list and t′\mathbf{t}^{\prime} the suffix of t\mathbf{t}: t′=(t2,t3,… )\mathbf{t}^{\prime}=(t_{2},t{}_{3},\dots). As for the bounce times, they are distributed as follows:

where T1:i−1=(T1,T2,…,Ti−1).T_{1:i-1}=\left(T_{1},T_{2},\ldots,T_{i-1}\right).

From this, we get the following decomposition:

Indeed, on the event that n≥1n\geq 1 bounces occur, the random variable h(Φt(z))h(\Phi_{t}(z)) only depends on a finite dimensional random vector, (T1,T2,…,Tn)(T_{1},T_{2},\dots,T_{n}), so we can write the expectation as an integral with respect to the density q~(t1:n;t,z)\widetilde{q}(t_{1:n};t,z) of these variables:

Marginal density. Let us fix some arbitrary time t>0t>0. We seek a convenient expression for the marginal density at time tt, μt(z)\mu_{t}(z), given an initial vector Z∼ρZ\sim\rho, where ρ\rho is the hypothesized stationary density ρ(z)=π(x)ψ(v)\rho(z)=\pi\left(x\right)\psi\left(v\right) on ZZ. To do so, we look at the expectation of an arbitrary non-negative measurable test function hh:

We used the following in the above derivation successively the law of total expectation, equation (S12), equation (S18), Tonelli’s theorem and the change of variables, z′=Ψt1:n,t(z)z^{\prime}=\Psi_{t_{1:n},t}(z), justified since for any fixed 0<t1<t2<⋯<tn<t<tn+10<t_{1}<t_{2}<\dots<t_{n}<t<t_{n+1}, Ψt1:n,t(⋅)\Psi_{t_{1:n},t}(\cdot) is a bijection (being a composition of bijections). Now the absolute value of the determinant is one since Ψt,t(z)\Psi_{\mathbf{t},t}\left(z\right) is a composition of unit-Jacobian mappings and, by using Tonelli’s theorem again, we obtain that the expression above the brace is necessarily equal to μt(z′)\mu_{t}(z^{\prime}) since hh is arbitrary.

Derivative. Our goal is to show that for all z′∈Zz^{\prime}\in\mathcal{Z}

Since the process is time homogeneous, once we have computed the derivative, it is enough to show that it is equal to zero at t=0t=0. To do so, we decompose the computation according to the terms InI_{n} in Equation (S22):

The categories of terms in Equation (S23) to consider are:

No bounce: n=0n=0, Ψt1:n,t(z)=Φt(z)\Psi_{t_{1:n},t}(z)=\Phi_{t}(z), or,

Exactly one bounce: n=1n=1, Ψt1:n,t(z)=Ft,t1:=Φt−t1∘C∘Φt1(z)\Psi_{t_{1:n},t}(z)=F_{t,t_{1}}:=\Phi_{t-t_{1}}\circ C\circ\Phi_{t_{1}}(z) for some t1∈(0,t)t_{1}\in(0,t), or,

Two or more bounces: n≥2n\geq 2, Ψt1:n,t(z)=Ψt−t2∘C∘Ft2,t1(z)\Psi_{t_{1:n},t}(z)=\Psi_{t-t_{2}}\circ C\circ F_{t_{2},t_{1}}(z) for some 0<t1<t2<t0<t_{1}<t_{2}<t

In the following, we show that the derivative of the terms in the third category, n≥2n\geq 2, are all equal to zero, while the derivative of the first two categories cancel each other.

No bounce in the interval. From Equation (S14):

We now compute the derivative at zero of the above expression:

The first term in the above equation can be simplified as follows:

using Equation (S4). In summary, we have:

Exactly one bounce in the interval. From Equation (S16), the trajectory consists in a bounce at a time T1T_{1}, occurring with density (expressed as before as a function of the final point z′z^{\prime}) q(t1;Ft,t1−1(z′))q(t_{1};F_{t,t_{1}}^{-1}(z^{\prime})), followed by no bounce in the interval (T1,t](T_{1},t], an event of probability:

where we used that C−1=CC^{-1}=C. This yields:

To compute the derivative of the above equation at zero, we use again Leibniz’s rule:

Two or more bounces in the interval. For a number of bounce, we get:

and hence, using Leibniz’s rule on the integral over t1t_{1}:

Putting all terms together. Putting everything together, we obtain:

where we used that ρ(z′)=ρ(C(z′))\rho(z^{\prime})=\rho(C(z^{\prime})), ⟨∇U(x′),R(x′)v′⟩=−⟨∇U(x′),v′⟩\left\langle\nabla U(x^{\prime}),R\left(x^{\prime}\right)v^{\prime}\right\rangle=-\left\langle\nabla U(x^{\prime}),v^{\prime}\right\rangle and −max⁡{0,f}+max⁡{0,−f}=−f-\max\{0,f\}+\max\{0,-f\}=-f for any function ff. Hence we have dμt(z′)dt∣t=0=0\left.\frac{{\rm d}\mu_{t}(z^{\prime})}{{\rm d}t}\right|_{t=0}=0, establishing that that the bouncy particle sampler λref=0\lambda^{\text{ref}}=0 admits ρ\rho as invariant distribution. The invariance for λref>0\lambda^{\text{ref}}>0 then follows from Lemma 4 given below.

Suppose PtP_{t} is a continuous time Markov kernel and QQ is a discrete time Markov kernel which are both invariant with respect to μ.\mu. Suppose we construct for λref>0\lambda^{\text{{ref}}}>0 a Markov process P^t\hat{P}_{t} as follows: at the jump times of an independent PP with intensity λref\lambda^{\text{{ref}}} we make a transition with QQ and then continue according to PtP_{t}, then P^t\hat{P}_{t} is also μ\mu-invariant.

Hence P^t\hat{P}_{t} is μ\mu-invariant. ∎

Appendix F Invariance of the local sampler

The generator of the local BPS is given by

The proof of invariance of the local BPS is very similar to the proof of Propostion 1. We have

where the term (S42) is straightforwardly equal to 0 while, by integration by parts, the term (S40) satisfies

as hh is bounded. Now a change-of-variables shows that for any f∈Ff\in F

as Rf−1(x)v)=R(x)vR_{f}^{-1}\left(x\right)v)=R\left(x\right)v and ∥Rf(x)v∥=∥v∥\left\|R_{f}\left(x\right)v\right\|=\left\|v\right\| implies ψ(Rf(x)v)=ψ(v)\psi\left(R_{f}\left(x\right)v\right)=\psi\left(v\right). So the term (S41) satisfies

where we have used ⟨∇Uf(x),Rf(x)v⟩=−⟨∇Uf(x),v⟩\left\langle\nabla U_{f}(x),R_{f}\left(x\right)v\right\rangle=-\left\langle\nabla U_{f}(x),v\right\rangle and max⁡{0,−f}−max⁡{0,f}=−f\max\{0,-f\}-\max\{0,f\}=-f for any ff. Hence, summing (S43)-(S45)-(S42), we obtain∫Lh(z)ρ(z)dz=0\mathcal{\int L}h(z)\rho\left(z\right){\rm d}z=0 and the result follows by [7, Proposition 34.7].

Appendix G Calculations in the isotropic normal case

As we do not use refreshment, it follows from the definition of the collision operator that

It follows that ⟨x(j),v(j)⟩≤0\left\langle x^{(j)},v^{(j)}\right\rangle\leq 0 for j>0j>0 if ⟨x(0),v(0)⟩≤0\left\langle x^{(0)},v^{(0)}\right\rangle\leq 0 so, in this case, we have

Appendix H Supplementary information on the evolutionary parameters inference experiments

We consider an over-parameterized generalized time reversible rate matrix with d=10d=10 corresponding to 4 unnormalized stationary parameters x1,…,x4x_{1},\dots,x_{4}, and 6 unconstrained substitution parameters x{i,j}x_{\{i,j\}}, which are indexed by sets of size 2, i.e. where i,j∈{1,2,3,4}, i≠ji,j\in\left\{1,2,3,4\right\},\thinspace i\neq j. Off-diagonal entries of QQ are obtained via qi,j=πjexp⁡(x{i,j})q_{i,j}=\pi_{j}\exp\left(x_{\{i,j\}}\right), where

We assign independent standard Gaussian priors on the parameters xi.x_{i}. We assume that a matrix of aligned nucleotides is provided, where rows are species and columns contains nucleotides believed to come from a shared ancestral nucleotide. Given x=(x1,…,x4,x{1,2},…,x{3,4}),x=\left(x_{1},\dots,x_{4},x_{\{1,2\}},\dots,x_{\{3,4\}}\right), and hence QQ, the likelihood is a product of conditionally independent continuous time Markov chains over {\{A, C, G, T}\}, with “time” replaced by a branching process specified by the phylogenetic tree’s topology and branch lengths. The parameter xx is unidentifiable, and while this can be addressed by bounded or curved parameterizations, the over-parameterization provides an interesting challenge for sampling methods, which need to cope with the strong induced correlations.

H.2 Baseline

We compare the BPS against a state-of-the-art HMC sampler that uses Bayesian optimization to adapt the the leap-frog stepsize ϵ\epsilon and trajectory length LL of HMC. This sampler was shown in to be comparable or better to other state-of-the-art HMC methods such as NUTS. It also has the advantage of having efficient implementations in several languages. We use the author’s Java implementation to compare to our Java implementation of the BPS. Both methods view the objective function as a black box (concretely, a Java interface supporting pointwise evaluation and gradient calculation). In all experiments, we initialize at the mode and use a burn-in of 100 iterations and no thinning. The HMC auto-tuner yielded ϵ=0.39\epsilon=0.39 and L=100L=100. For our method, we use the global sampler and the global refreshment scheme.

H.3 Additional experimental results

To ensure that BPS outperforming HMC does not come from a faulty auto-tuning of HMC parameters, we look at the ESS/s for the log-likelihood statistic when varying the stepsize ϵ\epsilon. The results in Figure S3(right) show that the value selected by the auto-tuner is indeed reasonable, close to the value 0.02 found by brute force maximization. We repeat the experiments with ϵ=0.02\epsilon=0.02 and obtain the same conclusions. This shows that the problem is genuinely challenging for HMC.