37
The Bouncy Particle Sampler: A Non-Reversible Rejection-Free Markov Chain Monte Carlo Method Alexandre Bouchard-Côté, Sebastian J. Vollmer and Arnaud Doucet 15th July 2019 * Department of Statistics, University of British Columbia, Canada. Department of Statistics, University of Oxford, UK. Abstract Many Markov chain Monte Carlo techniques that are available at present rely on discrete- time reversible Markov processes whose transition kernels are variations over the Metropolis– Hastings algorithm. We explore and generalize an alternative scheme recently introduced in the physics literature [22] where the target distribution is explored using a continuous- time non-reversible Markov process. In the Metropolis–Hastings algorithm, a trial move to a region of lower target density, equivalently to higher “energy”, than the current state can be rejected with positive probability. In this alternative approach, a particle moves along straight lines around the space and, when facing a high energy barrier, it is not rejected but its path is modified by bouncing against this barrier. By reformulating this algorithm using inhomogeneous Poisson processes, we show that it is possible to exploit standard simulation techniques to simulate exactly this Markov process in a wide range of scenarios of interest to statisticians. Additionally, when the target distribution is given by a product of factors involving only subsets of the state variables, such as the posterior distribution associated with a probabilistic graphical model, this method can be modified to take advantage of this structure by allowing computationally cheaper “local” bounces which only involve the state variables associated to a factor, while the other state variables keep on evolving. In this context, by exploiting the target structure and leveraging techniques from chemical kinetics, we propose several computationally efficient implementations. Experimentally, this new class of Markov chain Monte Carlo schemes compares favorably to state-of-the-art methods on various Bayesian inference tasks, including for high dimensional models and for large data sets. Keywords: Continuous-time Markov process; Inhomogeneous Poisson process; Markov chain Monte Carlo; Probabilistic graphical models; Rejection-free simulation. 1 Introduction Markov chain Monte Carlo (MCMC) methods are standard tools to sample from complex high- dimensional probability measures. Many MCMC schemes that are currently available are based on the celebrated Metropolis–Hastings (MH) algorithm and their efficiency is strongly dependent on the ability of the user to design proposal distributions capturing the main features of the target distribution; see [16] for a comprehensive review. We examine, analyze and generalize here a different approach to sample from distributions on R d that has been recently proposed in the physics literature [22]. Let the energy be defined as minus the logarithm of an unnormalized case of the target density. In the simplest version of this methodology, a particle is exploring the space 1 arXiv:1510.02451v3 [stat.ME] 27 Jan 2016

arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

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

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

15th July 2019

∗Department of Statistics, University of British Columbia, Canada.

†Department of Statistics, University of Oxford, UK.

Abstract

Many Markov chain Monte Carlo techniques that are available at present rely on discrete-time reversible Markov processes whose transition kernels are variations over the Metropolis–Hastings algorithm. We explore and generalize an alternative scheme recently introducedin the physics literature [22] where the target distribution is explored using a continuous-time non-reversible Markov process. In the Metropolis–Hastings algorithm, a trial move toa region of lower target density, equivalently to higher “energy”, than the current state canbe rejected with positive probability. In this alternative approach, a particle moves alongstraight lines around the space and, when facing a high energy barrier, it is not rejected butits path is modified by bouncing against this barrier. By reformulating this algorithm usinginhomogeneous Poisson processes, we show that it is possible to exploit standard simulationtechniques to simulate exactly this Markov process in a wide range of scenarios of interestto statisticians. Additionally, when the target distribution is given by a product of factorsinvolving only subsets of the state variables, such as the posterior distribution associatedwith a probabilistic graphical model, this method can be modified to take advantage of thisstructure by allowing computationally cheaper “local” bounces which only involve the statevariables associated to a factor, while the other state variables keep on evolving. In thiscontext, by exploiting the target structure and leveraging techniques from chemical kinetics,we propose several computationally efficient implementations. Experimentally, this new classof Markov chain Monte Carlo schemes compares favorably to state-of-the-art methods onvarious Bayesian inference tasks, including for high dimensional models and for large datasets.

Keywords: Continuous-time Markov process; Inhomogeneous Poisson process; Markov chain Monte Carlo;Probabilistic graphical models; Rejection-free simulation.

1 Introduction

Markov chain Monte Carlo (MCMC) methods are standard tools to sample from complex high-dimensional probability measures. Many MCMC schemes that are currently available are basedon the celebrated Metropolis–Hastings (MH) algorithm and their efficiency is strongly dependenton the ability of the user to design proposal distributions capturing the main features of the targetdistribution; see [16] for a comprehensive review. We examine, analyze and generalize here adifferent approach to sample from distributions on Rd that has been recently proposed in thephysics literature [22]. Let the energy be defined as minus the logarithm of an unnormalized caseof the target density. In the simplest version of this methodology, a particle is exploring the space

1

arX

iv:1

510.

0245

1v3

[st

at.M

E]

27

Jan

2016

Page 2: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

by moving along straight lines and, when it faces a high energy barrier, it bounces against thecontour lines of this energy. This non-reversible rejection-free MCMC method will be henceforthreferred to as the Bouncy Particle Sampler (BPS). This algorithm has already been adopted tosimulate complex physical systems such as hard spheres, polymers and spin models [15, 18, 19, 21].In those contributions it has been demonstrated experimentally that this scheme can outperformstate-of-the-art methods by up to several orders of magnitude.

However, the implementation of the BPS proposed in [22] is not suitable for most target distribu-tions arising from statistics problems as it requires integrating numerically a non-linear functionof the gradient of the energy along straight lines, hence introducing approximation errors andperturbing the invariant distribution of the resulting Markov process. In this article we make thefollowing contributions:

Exact simulation schemes: we propose a reformulation of the algorithm proposed by [22] whichshows that bounce times correspond to the first arrival time of an inhomogeneous Poissonprocess. This reformulation allows us to leverage standard simulation techniques [5, Chapter6] and recent methods from chemical kinetics [26] to obtain new computationally efficientways to simulate exactly the BPS process for a large class of statistical models.

Factor graphs: when the target distribution can be expressed as a factor graph [27], a represent-ation generalizing graphical models where the target is given by a product of factors and eachfactor can be a function of only a subset of variables, we show that a physical multi-particlesystem method discussed in [22, Section III] can be generalized to exploit this representationto achieve additional computational efficiency. This local version of the BPS only manipu-lates a restricted subset of the components of the states at each bounce but results in a changeof all state components, not just the one being updated contrary to standard algorithms suchas the Gibbs sampler.

Ergodicity analysis: we present a proof of the ergodicity of BPS when the velocity of the particleis additionally refreshed at the arrival times of a homogeneous Poisson process. When thisrefreshment step is not carried out, we exhibit a simple counter-example where ergodicitydoes not hold.

Efficient refreshment: we propose alternative refreshment schemes and compare their compu-tational efficiency experimentally.

We demonstrate empirically that these new MCMC schemes compare favorably to state-of-the-artMCMC methods on various Bayesian inference problems, including in high-dimensional problemsand for large data sets. In an extended version of this manuscript, we propose several additionaloriginal extensions of the BPS including versions of the algorithm which are applicable to mixedcontinuous-discrete distributions, distributions restricted to a compact support and a method re-lying on the use of curved dynamics instead of straight lines. These are not discussed here due tospace restrictions.

The rest of this article is organized as follows. In Section 2, we introduce the simplest version of theBPS, propose original ways to implement it and prove that it is ergodic under weak assumptions.Section 3 presents a modification of the original BPS which exploits the factor graph representationof a target distribution and computationally efficient implementations of this scheme. In Section4, we demonstrate this methodology on various Bayesian models. The proofs are given in theAppendix.

2 The bouncy particle sampler

2.1 Problem statement and notation

Consider a probability distribution π on Rd, equipped with the Borel σ-algebra B(Rd). We assumethat π admits a probability density with respect to the Lebesgue measure dx and slightly abuse

2

Page 3: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

−2

−1

0

1

2

3

0 1 2 3 4 5Time

value

namederivative

intensity

3

4

5

6

7

0 1 2 3 4 5Time

value

nameenergy

−10

−8

−6

−4

−2

−3 −2 −1 0 1 2

−3

−2

−1

0

1

2

−3 −2 −1 0 1 2 3

−3−2

−10

12

3

xBounds

yBounds

Contour plot of the energy, U(x) = - log π(x) Energy

First collision event

Second collision

event

Refreshment event

x(0)

τ1 v(0)

τ2 v(1)

x(1)

x(2)

τ3 v(2)

x(3)τ4 v(3)

τ2

τ*

- log V (an exponential random variable)

- log V

Figure 1: Left: an example of a trajectory produced by the BPS algorithm. The state-space isaugmented by a velocity vector v which is maintained constant for a random period of time. Afterthis amount of time, the trajectory can either bounce on the contour line of the energy at thecurrent location (the first two events shown), or undergo velocity refreshment (third event), wherethe velocity is updated independently of the location. The time at which each bounce event occursis determined by the first arrival time of an inhomogeous Poisson process. We show the simulationof the time between the first and second event on the top right. The intensity function is shownin turquoise, and the arrival times are denoted by stars. The intensity function χ(t) is obtainedby computing

⟨∇U

(x(1) + v(1)t

), v(1)

⟩(purple), and truncating the negative part. On the bottom

right, we illustrate a concrete method for computing the arrival times of this Poisson process,described in Example 1.

notation by denoting also this density by π. In most practical scenarios, we only have access to anunnormalized version of this density, that is

π (x) =γ (x)

Z,

where γ : Rd → (0,∞) can be evaluated point-wise but the normalizing constant Z =´Rd γ (x) dx

is unknown. We callU (x) = −log γ (x)

the associated energy, which is assumed continuously differentiable, and we denote by ∇U (x) =(∂U(x)∂x1

, . . . , ∂U(x)∂xd

)tthe gradient of U evaluated at x. We are interested in approximating numer-

ically the expectation of arbitrary test functions ϕ : Rd → R with respect to π.

2.2 Algorithm description

The basic BPS methodology introduced in [22] simulates a continuous trajectory {x (t)}t≥0 in Rd.The trajectory of the particle computed by BPS is composed of piecewise linear segments. Referto Figure 1 for an example a trajectory generated by BPS on a bivariate isotropic Gaussian targetdistribution. Each segment in the trajectory is specified by an initial position x(i) ∈ Rd, a lengthτi+1 ∈ R+ and a velocity v(i) ∈ Rd.

Let us denote the times where the velocity changes by ti =∑ij=1 τj for i ≥ 1, and set t0 = 0

for convenience. The position at time t ∈ [ti, ti+1) is thus interpolated linearly, x (t) = x(i) +v(i) (t− ti), and each segment is connected to the next, x(i+1) = x(i) + v(i)τi+1. To generate

3

Page 4: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

these segments, the algorithm relies on a position and velocity-dependent intensity function λ :Rd×Rd → [0,∞) and a position-dependent bouncing matrix R : Rd → Rd×d given respectively by

λ (x, v) = max {0, 〈∇U (x) , v〉} (1)

and for any v ∈ Rd

R (x) v =

(Id − 2

∇U (x) {∇U (x)}t

‖∇U (x)‖2

)v = v − 2

〈∇U (x) , v〉‖∇U (x)‖2

∇U (x) , (2)

where Id denotes the d × d identity matrix, ‖ · ‖ the Euclidean norm, and 〈w, z〉 = wtz thescalar product between column vectors w, z.1 The algorithm also performs a velocity refreshmentat random times distributed according to the arrival times of a homogeneous Poisson process ofintensity λref ≥ 0, λref being a parameter of the BPS algorithm. Throughout the paper, we usethe terminology “event” for a time at which either a bounce or a refreshment occurs. The basicversion of the BPS algorithm proceeds as follows:

Algorithm 1 Basic BPS algorithm

1. Initialize the state and velocity(x(0), v(0)

)arbitrarily on Rd × Rd.

2. While more events i = 1, 2, . . . requested do

(a) Simulate the first arrival time τbounce ∈ (0,∞) of an inhomogeneous Poisson process ofintensity χ (t) = λ(x(i−1) + v(i−1)t, v(i−1)).

(b) Simulate τ ref ∼ Exp(λref

).

(c) Set τi ← min (τbounce, τ ref) and compute the next position

x(i) ← x(i−1) + v(i−1)τi. (3)

(d) If τi = τ ref , sample the next velocity v(i) ∼ N (0d, Id).

(e) If τi = τbounce, compute the next velocity v(i) using

v(i) ← R(x(i))v(i−1), (4)

which is the vector obtained once v(i−1) bounces on the plane tangential to the gradientof the energy function at x(i).

3. End While.

In the algorithm above, Exp (δ) denotes the exponential distribution of rate δ and N (0d, Id)the standard Gaussian distribution on Rd.2 Compared to the algorithm described in [22], ourformulation of step 2a is expressed in terms of an inhomogeneous Poisson process arrival.

We will show further that the transition kernel of the resulting process x (t) admits π as invariantdistribution for any λref ≥ 0 but it can fail to be irreducible when λref = 0. It is thus critical touse λref > 0. Our proof of invariance and ergodicity can accommodate some alternative ways toperform the refreshment step 2d. One such variant, which we call restricted refreshment, samplesv(i) uniformly on the unit hypersphere Sd−1 =

{x ∈ Rd : ‖x‖ = 1

}. We compare experimentally

these two variants and others in Section 4.3.1Throughout the paper, when an algorithm contains an expressions of the form R(x)v, it is understood that this

computation is implemented via the right-hand side of Equation 2 which takes time O(d) rather than the left-handside, which would naively take time O(d2).

2By exploiting the memorylessness of the exponential distribution, we could alternatively only implement stepb) of Algorithm 1 for the ith event when τi−1 corresponds to a bounce and set τ ref ← τ ref − τi−1 otherwise.

4

Page 5: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

2.3 Algorithms for bounce time simulation

Implementing BPS requires sampling the first arrival time τ of a one-dimensional inhomogeneousPoisson process Π of intensity χ (t;x, v) = λ(x+ vt, v) given by (1). This intensity depends on theoutcome of the last event, but we omit notationally this dependence and write χ(t) = χ(t;x, v).This Poisson process Π is denoted by the stars in Figure 1. Simulation from such a process is a well-studied problem; see [5, Chapter 6, Section 1.3]. We briefly review here three standard methodsand show how they can be used to implement BPS for examples from Bayesian statistics. Thefirst 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 generalscenarios.

2.3.1 Simulation using a time-scale transformation

If we let Ξ (t) =´ t

0χ (s) ds, then the homogeneous Poisson process Π of intensity χ satisfies

P(τ > u) = P(Π ∩ [0, u) = ∅) = exp(−Ξ(u))(Ξ(u))0

0!,

and therefore τ can be simulated from a uniform variate V ∼ U (0, 1) via the identity

τ = Ξ−1(− log(V )), (5)

where Ξ−1 denotes the quantile function of Ξ, Ξ−1(p) = inf {t : p ≤ Ξ(t)} . Refer to Figure1, top right for a graphical illustration. This identity corresponds to the method proposed in[22] to determine the bounce times. Equivalently, this method can be viewed as transforming ahomogeneous Poisson process Π0 of unit rate via an appropriate time-scale transformation [3].

In general, it will not be possible to obtain an analytical expression for Equation (5). However,when the target distribution is strictly log-concave and differentiable, it is easy to use numericalmethods to efficiently solve Equation (5) up to numerical precision (see Example 1 below).

Example 1. Log-concave densities. Consider the case where the energy is strictly convex (seeFigure 1, bottom right). In this case, we can first minimize the energy along the line specified bythe initial point and velocity

τ∗ = argmint:t≥0 U (x+ vt) ,

where τ∗ is well defined and unique by strict convexity. On the interval [0, τ∗), which might beempty, we have dU (x+ vt) /dt < 0 and dU (x+ vt) /dt ≥ 0 on [τ∗,∞). The solution τ of (5) isthus necessarily such that τ ≥ τ∗ and (5) can be rewritten as

ˆ τ

τ∗

dU (x+ vt)

dsds = U (x+ vτ)− U (x+ vτ∗) = − log V.

Even if we only compute the energy U point-wise through a black box, we can still efficiently solvethis equation through line search within machine precision.

Example 2. Gaussian distributions. Consider the scenario where π is a zero-mean multivariateGaussian distribution of covariance matrix 1

2Id so that U (x) = ‖x‖2. Specializing Example 1,simple calculations yield:

τ =1

‖v‖2

−〈x, v〉+

√−‖v‖2 log V if 〈x, v〉 ≤ 0

−〈x, v〉+

√〈x, v〉2 − ‖v‖2 log V otherwise.

(6)

5

Page 6: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

2.3.2 Simulation using adaptive thinning

In scenarios where it is difficult to solve (5), the use of a thinning procedure to simulate τ providesanother alternative. Assume we have access to local-in-time upper bounds χs (t) on χ(t), that is

χs(t) = 0 for all t < s,

χs(t) ≥ χ(t) for all t ≥ s

and that we can simulate the first arrival time of the inhomogeneous Poisson process Πs withintensity χs(t) defined on [s,∞). Algorithm 2 shows the pseudocode for the adaptive thinningprocedure.

Algorithm 2 Simulation of the first arrival time of an inhomogeneous Poisson process throughthinning

1. Set s← 0, τ ← 0.

2. Do

(a) Set s← τ .

(b) Sample τ as the first arrival point of Πs of intensity χs.

(c) While V > χ(τ)χs(τ) where V ∼ U (0, 1).

3. Return τ .

In Algorithm 2, we call cases where V > χ(τ)χs(τ) coasting events. In contrast to rejection events that

occur in standard MCMC samplers, the particle continues to move when a coasting event occurs.

2.3.3 Simulation using superposition

Assume that U (x) can be decomposed as

U (x) =

m∑j=1

U [j] (x) . (7)

Under this assumption, if we let χ[j](t) = max(0,⟨∇U [j](x+ tv), v

⟩)for j = 1, ...,m, it follows

that

χ (t) ≤m∑j=1

χ[j] (t) .

It is therefore possible to use the adaptive thinning algorithm with χs(t) = χ(t) =∑mj=1 χ

[j] (t)for t ≥ s. Moreover, we can simulate from χ via superposition as follows. First, simulate the firstarrival time τ [j] of each inhomogeneous Poisson process with intensity χ[j] (t) ≥ 0. Second, return

τ = minj=1,...,m τ [j].

Example 3. Exponential families. Consider a univariate exponential family with parameter x,observation ι, sufficient statistic φ(ι) and log-normalizing constant A(x). If we assume a standardGaussian prior on x, we obtain the following energy:

U(x) = x2/2︸︷︷︸U [1](x)

+−xφ(ι)︸ ︷︷ ︸U [2](x)

+ A(x)︸ ︷︷ ︸U [3](x)

,

and the bounce intensities are given by:

χ[j](t) = max(

0,⟨∇U [j] (x+ vt) , v

⟩), j ∈ {1,2,3}.

6

Page 7: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

The bounce time τ [1] for χ[1] can be computed analytically (see Example 2) whereas the bouncetime τ [2] associated to χ[2] is given by

τ [2] =

{log V [2]

vφ(ι) if vφ(ι) > 0,

+∞ otherwise,

where V [j] ∼ U (0, 1). Finally, the bounce time τ [3] for χ[3] is given by

τ [3] =

{τ [3] if τ [3] > 0,

+∞ otherwise,

where τ [3] = A−1(− log V [3] +A(x))− x/v. For example, with a Poisson distribution with naturalparameter x, we obtain

τ [3] =log(− log V [3] + exp(x))− x

v.

Example 4. Logistic regression. We consider a binary logistic regression model. We index thedata by r ∈ {1, 2, . . . , R}, the class label of the data point r is denoted by cr and the covariatek ∈ {1, 2, . . . , d} for data r is denoted ιr,k. We assume for simplicity that ιr,k ≥ 0 (this assumptioncan be easily relaxed but would make the notation more complicated in the following). Theparameter vector x ∈ Rd is assigned a standard multivariate Gaussian prior distribution, withdensity denoted by ψ. This yields the following target posterior density:

π(x) ∝ ψ(x)

R∏r=1

exp(cr 〈ιr, x〉)1 + exp 〈ιr, x〉

. (8)

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

U [R+1](x) = − logψ(x) = ‖x‖2/2 + constant, (9)

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

U [r](x) = log(1 + exp 〈ιr, x〉)− cr 〈ιr, x〉 . (10)

We denote the corresponding intensities by χ[r]. Simulation of χ[R+1] is covered in Example 2, soin the following, we focus on the factors χ[r] for r ∈ {1, 2, . . . , R}. Simulation for those terms canbe approached using thinning. In Appendix B.1, we show that :

χ[r](t) ≤ χ[r] =

d∑k=1

1[vk(−1)cr ≥ 0]ιr,k|vk|. (11)

Since the bound is constant for a given v, we can sample τ [r] by simulating an exponential randomvariable. Sharper bounds could be borrowed from the variational inference literature [14].

2.4 Estimating expectations

Given a realization of the process x (t) over the interval [0, tn], the expectation´Rd ϕ (x)π (dx) of

a function ϕ : Rd → R with respect to π can be estimated using

1

tn

ˆ tn

0

ϕ (x (t)) dt =1

tn

n−1∑i=1

ˆ τi

0

ϕ(x(i−1) + v(i−1)s

)ds.

For example for ϕ (x) = xk, k ∈ {1, 2, . . . , d}, we haveˆ τi

0

ϕ(x(i−1) + v(i−1)s

)ds = x

(i−1)k τi + v

(i−1)k

τ2i

2.

7

Page 8: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

When the integral above is intractable, we may just subsample the trajectory of x (t) at regulartime intervals to obtain an estimator

1

L

L−1∑l=0

ϕ (x (lδ))

where δ > 0 and L = 1 + bT/δc . Alternatively, we could approximate these univariate integralsthrough quadrature.

2.5 Theoretical results

Peters and de With (2012) present an informal proof establishing the fact that the BPS withλref = 0 admits π as invariant distribution. We provide in Appendix A a rigorous proof of thisπ-invariance result for λref ≥ 0 and prove that the resulting process is additionally ergodic whenλref > 0. In the following we denote by Pt(z,dz

′) the transition kernel of the continuous-timeMarkov process z (t) = (x (t) , v (t)).

Proposition 1. For any λref ≥ 0, the infinitesimal generator associated to the transition kernelPt of the BPS is given, for any given continuously differentiable functions h : Rd × Rd → R, by

Lh(z) = limt→0

´Pt(z, dz′)h(z′)− h(z)

t

= −λ (x, v)h(z) + 〈∇xh, v〉+ λref

ˆ(h(x, v′)− h(x, v))ψ ( dv′)

+λ (x, v)h(x,R (x) v),

where we recall that ψ (v) denotes the standard multivariate Gaussian density on Rd.

This transition kernel is non-reversible and ρ-invariant, where

ρ(z) = π (x)ψ (v) . (12)

If we add the condition λref > 0, we get the following stronger result.

Theorem 1. If λref > 0 then ρ is the unique invariant probability measure of the transition kernelof the BPS and the corresponding process satisfies a strong law of large numbers for ρ-almost everyz (0) and h ∈ L1 (ρ)

limT→∞

1

T

ˆ T

0

h(z (t))dt =

ˆh(z)ρ(z)dz a.s.

We exhibit in Section 4.1 a simple example where Pt is not ergodic for λref = 0.

3 The local bouncy particle sampler

3.1 Structured target distribution and factor graph representation

In numerous applications, the target distribution admits some structural properties that can beexploited by sampling algorithms. For example, the popular Gibbs sampler takes advantages ofconditional independence properties. We present here a “local” version of the BPS which canexploit any representation of the target density as a product of positive factors

π (x) ∝∏f∈F

γf (xf ) (13)

8

Page 9: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

−2 −1 0 1−2 −1 0 1−2 −1 0 1−2 −1 0 1

0123

05

1015

20tim

e

position −2 −1 0 1−2 −1 0 1−2 −1 0 1−2 −1 0 1

0123

05

1015

20tim

e

position −2 −1 0 1−2 −1 0 1−2 −1 0 1−2 −1 0 10123

05

1015

20tim

e

position −2 −1 0 1−2 −1 0 1−2 −1 0 1−2 −1 0 1

0123

05

1015

20tim

e

position

Time

x1 x2 x3 x4

x1(0)

x1(1)

x1(2)

x2(0)

x2(1)x2(2)

x2(3)

x2(4)

x1(3) x2(5)

x3(0)

x3(1)x3(2)

x4(0)

fa fb fc

t

*

!

Figure 2: Top: an example of a factor graph with d = 4 variables and 3 binary factors, F ={fa, fb, fc}. Bottom: an example of paths generated by the local BPS algorithm. The circlesshow the locations that are stored in memory (each with their associated time and velocity afterbouncing, not shown). The small black square on the first path is used to demonstrate the executionof Algorithm 3, used to reconstruct the location x(t). The algorithm first identifies i(t, 1), which is3 in this example. The algorithm then uses the information of the latest event preceding xt to addto the position at that event, x(3)

1 , the velocity just after the event, v(3)1 , times the time increment

denoted by the asterisk, (t − T (3)1 ). The bottom section of the figure also shows the candidate

bounce times used by Algorithm 4 to compute the first four bounce events. The exclamationmark indicates an example where a candidate bounce time need not be recomputed thanks to thesparsity structure of the factor graph.

where xf is a restriction of x to a subset Nf ⊆ {1,2,. . . ,d} of the components of x, and F is anindex set called the set of factors. Hence the energy associated to π is of the form

U (x) =∑f∈F

Uf (x) (14)

with ∂Uf (x) /∂xk = 0 for all variable absent from factor f , i.e. for all k ∈ {1, 2, . . . , d} \Nf .

Such a factorization of the target density can be formalized using factor graphs (Figure 2, top). Afactor graph is a bipartite graph, with one set of vertices N called the variables, each correspondingto a component of x (|N | = d), and a set of vertices F corresponding to the local factors (γf )f∈F .There is an edge between k ∈ N and f ∈ F if and only if k ∈ Nf . Such a representation generalizesundirected graphical models [27, Chap. 2, Section 2.1.3]. For example, factor graphs can havedistinct factors connected to the same set of components (i.e. f 6= f ′ with Nf = Nf ′).

3.2 Local BPS: algorithm description

Similarly to the Gibbs sampler, each step of the local BPS manipulates only a subset of the dcomponents of x. Contrary to the Gibbs sampler, the local BPS does not require sampling fromany 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 fullstate at each iteration is described below.

9

Page 10: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

For each factor f ∈ F , we define a local intensity function λf : Rd×Rd → R+ and a local bouncingmatrix Rf : Rd → Rd×d by

λf (x, v) = max {0, 〈∇Uf (x) , v〉} , (15)

Rf (x) v = v − 2〈∇Uf (x) , v〉∇Uf (x)

‖∇Uf (x)‖2. (16)

It is easy to check that Rf (x) satisfies

k ∈ {1, 2, . . . , d} \Nf =⇒ (Rf (x)v)k = vk. (17)

When suitable, we will slightly abuse notation and write Rf (xf ) for Rf (x) as Rf (xf , x−f ) =

Rf

(xf , x

′−f

)for any x−f , x′−f ∈ Rd−|Nf |. Similarly, we will use λf (xf , vf ) for λf (x, v).

We define a collection of Poisson process intensities based on the previous event position x(i−1) andvelocity v(i−1): χf (t) = χf (t;x(i−1), v(i−1)) = λf (x(i−1) + v(i−1)t, v(i−1)). In the local version ofBPS, the next bounce time τ is the first arrival of an inhomogeneous Poisson process with intensityχ(t) =

∑f∈F χf (t). However, instead of modifying all velocity variables at a bounce as in the

basic BPS, we first sample a factor f with probability χf (τ)/χ(τ) and modify only the variablesconnected to the sampled factor in the factor graph. More precisely, the velocity vf is updatedusing Rf (xf ) defined in Equation (16). If all the factors are connected to the same variables, theresulting algorithm is an alternative to the method presented in 2.3.3. A generalization of the proofof Proposition 1 given in Appendix A.3 shows that this local BPS algorithm results in a π−invariantkernel. In the next subsection, we describe various computationally efficient procedures to simulatethis process.

For all these implementations, it is useful to encode trajectories in a sparse fashion: each variablek ∈ N only records information at the times T (1)

k , T(2)k , . . . where an event (a bounce or refreshment)

affected it. By Equation (17), this represents a sublist of the list of all event times. At each ofthose times T (i)

k , the component’s position x(i)k and velocity v(i)

k right after the event is stored. LetLk = L

(0:I)k denotes the list of triples

((x

(0)k , v

(0)k , 0), (x

(1)k , v

(1)k , T

(1)k ), . . . , (x

(I)k , v

(I)k , T

(I)k )

), where

x(0)k and v(0)

k denote the initial position and velocity (see Figure 2, where we show the sparse set ofrecorded positions). The list L(0:I−1)

k is sufficient to interpolate or extrapolate the position xk(t).This procedure is detailed in Algorithm 3 and an example is shown in Figure 2. The same procedurecan obviously also be used to obtain a subset of node positions, for example those connected to afactor f , denoted xf (t).

Algorithm 3 Interpolation/extrapolation at time t of the position of node k from a list of events.

1. Find the index i(t, k) associated to the largest time T (i)k verifying T (i)

k ≤ t.

2. Return x(i(t,k))k + (t− T (i(t,k))

k )v(i(t))k .

3.3 Local BPS: efficient implementations

3.3.1 Implementation via priority queue

One way to sample arrivals from a Poisson process with intensity χ(t) =∑f∈F χf (t) and selecting

a factor f with probability proportional to χf (t) consists of using the superposition method.We maintain “candidate” bounce times Tf , one for each factor, which are stored in a priorityqueue Q. This data structure ensures that finding the minimum element can be performed withcomputational complexity O(log |F |), and that insertion or update of an element can be performedin O(log |F |). During the execution of the local algorithm, whereas the lists Lk is used to store

10

Page 11: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

past, confirmed events, Q is used to store potential future bounce times (called candidates), onlya subset of which will make it to the lists Lk.

We pick the smallest time from the queue Q to determine the next bounce time. When a bounceoccurs, a key observation behind efficient implementation of the local BPS is that not all theother candidate bounce times need to be recalculated. Suppose that the bounce was associatedwith factor f . In this case, only the candidate bounce times Tf ′ corresponding to factors f ′ withNf ′ ∩Nf 6= ∅ need to be recalculated. For example, consider the first bounce in Figure 2 (shownin purple), which is triggered by factor fa. Then only the velocities for the variables x1 and x2

need to be updated. Therefore, only the candidate bounce times for factors fa and fb need to beupdated. The candidate bounce time for fc stays constant at that time step (this is shown by anexclamation mark in the figure).

The method is detailed in Algorithm 4.

11

Page 12: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

Algorithm 4 Local BPS algorithm (priority queue implementation)

1. Initialize the state and velocity(x(0), v(0)

)arbitrarily on Rd × Rd.

2. Initialize the global clock T ← 0.

3. For k ∈ N do

(a) Initialize the list Lk ←(x

(0)k , v

(0)k , T

).

4. Set Q← new queue(x(0), v(0), T

).

5. Sample Tref ∼ Exp(λref

).

6. While more events i = 1, 2, . . . requested do

(a) (T, f)← select (pop) smallest candidate bounce time (Q) (T is the time, f is theassociated factor).

(b) If T < Tref then

i. (vf )k ← v|Lk|−1k for all k ∈ Nf .

ii. xf ← xf (T ) (computed using Algorithm 3).iii. For k ∈ Nf do

A. j ← |Lk|.B. x(j)

k ← x(j−1)k + (T − T (j−1)

k )v(j−1)k .

C. v(j)k ← {Rf (xf ) vf}k.

D. Lk ←{Lk,

(x

(j)k , v

(j)k , T

)}(add the new sample to the list).

iv. For f ′ ∈ F : Nf ′ ∩Nf 6= ∅ (note: this includes the update of f) do

A. (vf ′)k ← v(|Lk|−1)k for all k ∈ Nf ′ .

B. xf ′ ← xf ′(T ) (computed using Algorithm 3).C. Simulate the first arrival time τf ′ of an inhomogeneous Poisson process of in-

tensity χ(t) = λf ′ (xf ′ + tvf ′ , vf ′) on [0,+∞).D. Set in Q the time associated to f ′ to the value T + τf ′ .

(c) Else

i. Sample v′ ∼ N (0d, Id).ii. Q ← new queue (x, v′, Tref) where x is the state at time Tref obtained from Al-

gorithm 3.iii. Set Tref ← Tref + τref where τref ∼ Exp

(λref

).

7. Return the samples encoded as the lists Lk, k ∈ N .

12

Page 13: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

Algorithm 5 New Queue (x, v, T )

1. For f ∈ F do

(a) (vf )k ← v|Lk|−1k for all k ∈ Nf .

(b) xf ← xf (T ) (computed using Algorithm 3).

(c) Simulate the first arrival time τf of an inhomogeneous Poisson process of intensityχ(t) = λf (xf + tvf , vf ) on [0,+∞).

(d) Set in Q the time associated to f to the value T + τf .

2. Return Q

3.3.2 Implementation via thinning

When the number of factors involved in Step 6(b)iv is large, the previous queue-based implement-ation is potentially computationally expensive. The simplest statistical problem where this arisesis when we are interested in sampling the posterior density of a parameter x and have access to alarge number R of observations conditionality independent given x. In these cases, we can associateone factor to the prior and one factor for each observation so the total number of factors is R+ 1and xf = x for all f ∈ F .

Implementing BPS in this setup is closely related to the problem of simulating stochastic chemicalkinetics and innovative solutions have been proposed in this area. We adapt here the algorithmproposed in [26] to the BPS context. For ease of presentation, we present the algorithm withoutrefreshment and only detail the simulation of the bounce times. This algorithm relies on the abilityto compute local-in-time upper bounds on λf for all f ∈ F . More precisely, we assume that givena current position x and velocity v, and ∆ ∈ (0,∞], we can find a positive number χf , such thatfor any t ∈ [0,∆), we have χf ≥ λf (x+vt, v). We can also use this method on a subset G of F andcombine it with the previously discussed techniques to sample candidate bounce times for factorsin F\G but we restrict ourselves to G = F to simplify the presentation.

13

Page 14: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

Algorithm 6 Local BPS algorithm (thinning implementation)

1. Initialize the state and velocity(x(0), v(0)

)arbitrarily on Rd × Rd.

2. Initialize the global clock T ← 0.

3. Initialize T ←4.

4. Compute local-in-time upper bounds χf such that χf ≥ λf (x(0) +v(0)t, v(0)) for all t ∈ [0,∆)and f ∈ F .

5. While more events i = 1, 2, . . . requested do

(a) Sample τ ∼ Exp(λ)where χ =

∑f∈F χf .

(b) Set T ← T + τ .

(c) If(T > T

)then

i. x(i) ← x(i−1) + (T − T )v(i−1).ii. v(i) ← v(i−1).iii. For all f ∈ F , update the local-in-time upper bound λf to ensure that χf ≥

λf (x(i) + v(i)t, v(i)) for t ∈ [0,∆).iv. Set T ← T , T← T +4.

(d) Else

i. Sample F ∈ F where P (F = f) = χf/χ.

ii. If V < λF(x(i−1) + v(i−1)τ, v(i−1)

)/χF where V ∼ U (0, 1) then a bounce for factor

F occurs at time T .A. x(i) ← x(i−1) + v(i−1)τ .B. v(i)← Rf

(x(i))v(i−1).

C. For all f ′ ∈ F : Nf ′ ∩ NF 6= ∅, update the local-in-time upper bound χf ′ toensure that χf ′ ≥ λf ′(x(i) + v(i)t, v(i)) for t ∈ [0, T − T ).

iii. ElseA. x(i) ← x(i−1) + v(i−1)τ .B. v(i) ← v(i−1).

This implementation will be particularly useful in scenarios where the operations that involveiterating over F can be done implicitly. More precisely, there are two such operations: summingover the bounds (Step 5a) and sampling over the normalized bounds (Step 5(d)i). There aresituations where it is possible to implement these two operations in constant time as illustrated inSection 4.6 for logistic regression. This method only requires an initial pre-processing of complexityO (|F | log |F |) before running the algorithm. Another scenario where sampling quickly from F isfeasible is if the number of distinct upper bounds is much smaller than the number of factors.

4 Numerical results

4.1 Multivariate Gaussian distributions and the need for refreshment

We use a simple isotropic multivariate Gaussian target distribution, U (x) = ‖x‖2, to illustrate theimportance of velocity refreshment, restricting ourselves here to BPS with restricted refreshment.Without loss of generality, we assume ‖v(i−1)‖ = 1. From Equation (6), we obtain⟨

x(i), v(i)⟩

=

{−√− log Vi if

⟨x(i−1), v(i−1)

⟩≤ 0

−√⟨

x(i−1), v(i−1)⟩2 − log Vi otherwise

14

Page 15: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

−4 −2 0 2

−3−2

−10

12

3

xBounds

yBounds

100

101

102

103

104

105

101 102 103 104 105

Dimension

ES

S p

er c

pu s

econ

d

Slope=−1.24

Figure 3: Left: A trajectory of the BPS for λref = 0, the center of the space is never explored.Right: ESS per CPU second for increasing d for the process with refreshment.

and

∥∥∥x(i)∥∥∥2

=

{∥∥x(i−1)∥∥2 −

⟨x(i−1), v(i−1)

⟩2 − log Vi if⟨x(i−1), v(i−1)

⟩≤ 0∥∥x(i−1)

∥∥2 − log Vi otherwise..

In particular, these calculations show that if⟨x(i), v(i)

⟩≤ 0 then

⟨x(j), v(j)

⟩≤ 0 for j > i. Using

this result, we can show inductively that ‖x(i)‖2 =∥∥x(1)

∥∥2 −⟨x(1), v(1)

⟩2 − log Vi for i ≥ 2. Inparticular for x(0) = e1 and v(0) = e2 with ei being elements of standard basis of Rd, the norm ofthe position at all points along the trajectory can never be smaller than 1 as illustrated in Figure3.

In this scenario, we show that BPS without refreshment admits a countably infinite collectionof invariant distributions. Again, without loss of generality, assume ‖v (0) ‖ = 1. Let us definert = ‖x (t)‖ and mt = 〈x (t) , v (t)〉 / ‖x (t)‖ and denote by χk the probability density of the chidistribution with k degrees of freedom.

Proposition 2. For any dimension d ≥ 2, the process (rt,mt)t≥1 is Markov and its transition ker-nel is invariant w.r.t the probability densities

{fk(r,m) ∝ χk(

√2r) · (1−m2)(k−3)/2; k ∈ {2, 3, 4, . . .}

}.

By Theorem 1, we have a unique invariant measure as soon as λref > 0.

Next, we look at the scaling of the Effective Sample Size (ESS) per CPU second of the basic BPSalgorithm as the dimensionality d of the isotropic normal target increases. We use λref = 5. Wefocus without loss of generality on the first component of the state vector and estimate the EffectiveSample Size (ESS) using the R package mcmcse [7] by evaluating the trajectory on a sufficientlyfine 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.24, similar to the d−5/4 scaling for an optimally tunedHamiltonian Monte Carlo (HMC) algorithm in a similar same setup [4, Section III], [20, Section5.4.4]. Both BPS and HMC compare favorably to the d−2scaling of the optimally tuned randomwalk MH [23].

4.2 Comparison of the global and local schemes

To quantify the potential computational advantage brought by the local version of the algorithmof Section 3 over the global version of Section 2, we compare both algorithms on a sparse Gaussian

15

Page 16: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

●●●

●●

●●●

● ●●●

●●● ●

●●●

●●●

●●●●●

●●●

●●

●●

●●● ●

●●●●●

●●

●●

●●●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●

●●

●●●

●●●●●●

●●●

●●

●●

●● ●●●

●●

●●

●●●

● ●

●●●

●●●

●●

●●●

●●●●

●●●

●●

●●

●●●●●

●●

●●●

●●

●●

●●●●●●●●●

●●●

●●●●

●●●

● ●●

●●

●●●

1e−04

1e−02

1e+00

0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9Pairwise precision parameter

Rel

ativ

e er

ror

is_local

false

true

Figure 4: Relative errors for Gaussian chain-shaped random fields. Facets contain results for fieldsof pairwise precisions 0.1-0.9. Each summarizes the relative errors of 200 (100 local, 100 global)local BPS executions, each ran for a fixed computational budget (a wall-clock time of 60 seconds).

field. We use a chain-shaped undirected graphical model of length 1000, and perform separate ex-periments for various pairwise precision parameters for the pairwise interaction between neighborsin the chain. We run the local and global methods for a fixed computational budget (60 seconds),and repeat the experiment in each configuration 100 times. We compute a Monte Carlo estimate ofthe marginal variance of variable index 500, and compare this estimate to the truth (which can becomputed explicitly in this case). The results are shown in Figure 4, in the form of an histogramover relative absolute errors of the 100 executions of each setup. They confirm that the smallercomputational complexity per local bounce more than offsets the associated decrease in expectedtrajectory segment length. Moreover, the results show that the BPS method is very robust to thepairwise precision used in this sparse Gaussian field model.

4.3 Comparisons of alternative refreshment schemes

In Section 2 and Section 3, the velocity was refreshed using a standard multivariate normal. Wecompare here this scheme to alternative refreshment schemes:

Global refreshment: sample the entire velocity vector from an standard multivariate Gaussiandistribution.

Local refreshment: if the local BPS is being used, the structure specified by the factor graphcan be used to design computationally cheaper refreshment operators. We pick one factorf ∈ F uniformly at random, and we consider resampling only the components of v withindices in Nf . By the same argument used in Section 3, each refreshment will then requirebounce time recomputation only for the factors f ′ with Nf ∩ Nf ′ 6= ∅. Provided that eachvariable is connected with at least one factor f with |Nf | > 1, this scheme is irreducible(and if this condition is not satisfied, additional constant factors can be introduced withoutchanging the target distribution).

Restricted refreshment: this method adds a restriction that the velocities be of unit norm. Thisscheme corresponds to a different invariant distribution ρ (x) = π (x)φ (v) whereφ (v) is nowthe uniform distribution on Sd−1. Refreshment is thus performed by the global refreshmentscheme, followed by a re-normalization step.

Restricted partial refreshment: a variant of the restricted refreshment scheme where we samplean angle θ by multiplying a Beta(α, β)-distributed random variable by 2π. We then select avector uniformly at random from the unit length vectors that have an angle θ from v. Weused α = 1, β = 4 to favor small angles.

The rationale behind the partial refreshment procedure is to suppress the random walk behaviorof the particle path arising from a refreshment step independent from the current velocity. Some

16

Page 17: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●●●

●●●

●●●●●

1e−04

1e−02

1e+00

1e−04

1e−02

1e+00

1001000

GLOBAL LOCAL PARTIAL RESTRICTEDRefreshment type

Rel

ativ

e er

ror

Ref. rate

0.01

0.1

1

10

Figure 5: Comparison of four refreshment schemes. The top panel shows results for a 100-dimensional problem, and the bottom one, for a 1000-dimensional problem. The box plots sum-marize the marginal variance (in log scale) of the variable with index 50 over 100 executions ofBPS for each of the refreshment schemes.

refreshment is needed to ensure ergodicity but a “good” direction should only be altered slightly.This strategy is akin to the partial momentum refreshment strategy for HMC methods [12], [20,Section 4.3] and, for a normal refreshment, could be similarly implemented. By Lemma 2 all ofthe above schemes preserve ρ as invariant distribution. We tested these schemes on two versionsof the chain-shaped factor graph from the previous section (with the pairwise precision parameterset to 0.5), one with 100 dimensions, and one with 1000 dimensions. All methods are providedwith a computational budget of 30 seconds. The results are shown in Figure 5. The results showthat the local refreshment scheme is less sensitive to λref , performing as well or better than theglobal refreshment scheme. The performance of the restricted and partial methods appears moresensitive to λref and generally inferior to the other two schemes.

4.4 Comparisons with HMC methods on high-dimensional multivariateGaussian distributions

We compare the local BPS to various state-of-the-art versions of HMC. We use the local refreshmentscheme, no partial refreshment and λref = 1. We select a 100-dimensional Gaussian example from[20, Section 5.3.3.4], where even a basic HMC scheme was shown to perform favorably comparedto standard MH methods. We run several methods for this test case, each for a wall clock time of30 seconds, and measure the relative error on the reconstructed marginal variances. We use Stan[11] as a reference implementation for the HMC algorithms. Different HMC versions are exploredby enabling and disabling the NUTS methodology for determining path lengths, and by enablingand disabling adaptive estimation of a diagonal mass matrix. We always exclude the time takento compile the Stan program in the 30 seconds budget. The three HMC methods tested use 1000iterations of adaptation, since HMC without adaptation (not shown) yields a zero acceptance rate.In contrast, we use the default value for our local algorithm’s tuning parameter (λref = 1), andno adaptation of the mass matrix. The results (Figure 6) show that this simple implementationperforms remarkably well. The adapted HMC performs reasonably well, except for four marginalswhich are markedly off target. These deviations disappear after incorporating more complex HMCextensions, namely learning a diagonal metric (denoted fit-metric), and adaptively selecting thenumber of leap-frog steps (denoted nuts).

Next, we perform a series of experiments to investigate the comparative performance of our localmethod versus NUTS as the dimensionality d increases. Experiments are performed on the chain-shaped Gaussian Random Field of Section 4.2 (with the pairwise precision parameter set to 0.5).

17

Page 18: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

−0.6

−0.4

−0.2

0.0

0.2

0.4

0 25 50 75 100Dimension

Rel

ativ

e er

ror

Sampling methodBPS(adapt=false,fit−metric=false)Stan/HMC(adapt=true,fit−metric=false,nuts=false)Stan/HMC(adapt=true,fit−metric=false,nuts=true)Stan/HMC(adapt=true,fit−metric=true,nuts=false)Stan/HMC(adapt=true,fit−metric=true,nuts=true)

Figure 6: Relative error of marginal variance estimates for a fixed computational budget (30s).

10 100 1000

0.01

0.10

0 25 50 75 100 0 25 50 75 100 0 25 50 75 100Percent of samples processed

Rel

ativ

e er

ror

(log

scal

e) method

BPS

Stan

Figure 7: Relative reconstruction error for d = 10 (left), d = 100 (middle) and d = 1000 (right),averaged over 10 of the dimensions and 40 runs. Each panel is ran on a fixed computational budget(corresponding in each panel to the wall clock time taken by 2000 Stan iterations).

We vary the length of the chain (10, 100, 1000), and run Stan’s implementation of NUTS for 1000iterations + 1000 iterations of adaptation. We measure the wall-clock time (excluding the timetaken to compile the Stan program) and then run our method for the same wall-clock time. Werepeat this 40 times for each chain size. We then measure the absolute value of the relative error on10 equally spaced marginal variances, and show the rate at which they decrease as the percentageof the samples collected in the fixed computational budget varies from 1 percent to 100 percent.The results are displayed in Figure 7. Note that the gap between the two methods widen as thedimensionality increases. To visualize the different behavior of the two algorithms, we show inFigure 8 three marginals of the Stan and BPS paths from the 100-dimensional example for thefirst 0.5% of the full trajectories computed in the computational budget.

4.5 Poisson-Gaussian Markov random field

We consider the following hierarchical model. Let xi,j : i, j ∈ {1, 2, . . . , 10} denote a sparseprecision, grid-shaped Gaussian Markov random field with pairwise interactions of the same formas those used in the previous chain examples (pairwise precision set to 0.5). For each i, j, let yi,jbe Poisson distributed, independent given x = (xi,j : i, j ∈ {1, 2, . . . , 10}), with rate exp(xi,j). Wegenerate a synthetic dataset from this model and approximate the posterior distribution of x givendata y = (yi,j : i, j ∈ {1, 2, . . . , 10}). We run Stan with default settings for 16, 32, 64, . . . , 4096iterations. For each configuration, we run local BPS for the same wall-clock time as Stan, usinga local refreshment with λref = 1 and the method from Example 3 to perform the bouncing timecomputations. We repeat this series of experiments 10 times with different random seeds for thetwo samplers. We show in Figure 9 estimates of the posterior variances of the variables indexed 0(x0,0), and 50 (x5,0). These two marginals are representative of the other variables. Each box plotsummarizes the 10 replications. As expected, both methods converge to the same value, but BPS

18

Page 19: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

0 50

−2

−1

0

1

2

0.0 0.1 0.2 0.3 0.4 0.5 0.0 0.1 0.2 0.3 0.4 0.5Percent of samples processed

Sam

ple

method

BPS

Stan

Figure 8: Marginals of the paths for variables index 0 (the left-most variable in the chain) andindex 50 (a variable in the middle of the chain). Each of the two marginal paths represent 0.5%of the full trajectory computed in the fixed computational budget used in the 100-dimensionalexample of Figure 7. While each piecewise constant step in the HMC trajectory is obtained by asequence of leap-frog steps, the need for a MH step in HMC means that these intermediate stepsare not usable Monte Carlo samples. In contrast, the full trajectory obtained from BPS can beused in the calculation of Monte Carlo averages, as explained in Section 2.4.

0 50

● ●

● ●● ●

0.2

0.4

0.6

16 32 64 128 256 512 1024 2048 4096 16 32 64 128 256 512 1024 2048 4096Number of Stan iterations (BPS ran with Stan's wall clock time as time limit)

Est

imat

e

sampling_method

BPS

Stan

Figure 9: Left: estimates of the posterior variance of x0,0; and right, of x5,0. Each pair of box-plotsis constructed by running Stan with default settings for a set number of iterations, then runningBPS with default settings for the same wall-clock time, and repeating this 10 times with differentrandom seeds.

requires markedly less computing time to achieve any given level of accuracy.

4.6 Bayesian logistic regression for large data sets

We consider the logistic regression model introduced in Example 4 in a scenario where a large num-ber of data R is available. In this context, standard MCMC schemes such as the MH algorithmare computationally expensive as they require evaluating the likelihood associated to the R obser-vations at each iteration. This problem has motivated the development of techniques which onlyevaluate the likelihood of a subset of the data at each iteration. However, most of the methodscurrently available introduce either some non-vanishing asymptotic bias, e.g. the subsampling MHscheme proposed in [2], or provide consistent estimates converging at a slower rate than regularMCMC algorithms, e.g. the Stochastic Gradient Langevin Dynamics introduced in [29, 25]. To thebest of our knowledge, the only available algorithm which only requires evaluating the likelihoodof a subset of data at each iteration yet provides consistent estimates converging at the standardMonte Carlo rate is the Firefly algorithm [17].

As alluded to at the beginning of Section 3.3.2, in this context, we can associate R + 1 factors to

19

Page 20: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

10−5

10−4

10−3

10−2

10−1

101 102 103 104 105

Number of datapoints (R)

ES

S p

er li

kelih

ood

eval

uatio

n

Algorithm BPS constant refresh rate Tuned FireFly

Figure 10: ESS per-datum likelihood evaluation for Local BPS and Firefly.

the target posterior distribution: one for the prior and one for each data point with xf = x forall f ∈ F . After a pre-computation step of complexity O(R logR) only executed once, we showhere that Algorithm 6 can be implemented such that the computational cost of each bounce isindependent of R and thus provides an alternative to the Firefly algorithm. Our implementationrelies on the fact that Step 5a and Step 5(d)i can be performed without enumerating the factors.

We first pre-compute the sum of covariates over the data points, ιck =∑Rr=1 ιr,k1[cr = c], for each

dimensionality k ∈ {1, . . . , d} and class label c. Using these pre-computed quantities, it is thenpossible to compute the sum χ of the bounding rates χ[r] defined in (11):

χ =

R∑r=1

χ[r] =

d∑k=1

|vk| ι1[vk<0]k .

If d is large, we can maintain χ in memory and to add and subtract any local updates to it. Theimplementation of Step 5(d)i relies on the alias method [5, Section 3.4]. A detailed description ofthese derivations and of the algorithm is presented in Appendix B.

We compare the local BPS with thinning to the MAP-tuned Firefly algorithm implementationprovided by the authors. In [17], it is reported that this version of Firefly outperforms experiment-ally significantly the standard MH in terms of ESS per-datum likelihood. Local BPS and Fireflyare here compared in terms of this criterion, where the ESS is averaged over the d = 5 componentsof x. We generate covariates as ιrk

i.i.d.∼ U(0.1, 1.1) and data cr ∈ {0, 1} for r = 1, . . . , R accordingto (8). We set a standard multivariate normal prior for x. For the algorithm, we set λref = 0.5 and∆ = 0.5, which is the length of the time interval for which a constant upper bound for the rateassociated with the prior is used, see Algorithm 7. Experimentally, local BPS always outperformsFirefly, by about an order of magnitude for large data sets. However, we also observe that bothFirefly and local BPS have an ESS per datum likelihood evaluation decreasing in approximately1/R so that the gains brought by these algorithms over a correctly scaled random walk MH al-gorithm do not appear to increase with R. The rate for local BPS is slightly superior in the regimeof up to 104 data points, but then returns to the approximate 1/R rates. We expect that tighterbounds on the intensities could improve the computational efficiency.

20

Page 21: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

4.7 Bayesian inference of evolutionary parameters

We consider a model from phylogenetics. Given a fixed tree of species with DNA sequences atthe leaves, we want to compute the posterior evolutionary parameters encoded into a rate matrixQ. More precisely, we consider an over-parameterized generalized time reversible rate matrix [24]with d = 10: 4 unnormalized stationary parameters x1, . . . , x4, and 6 unconstrained substitutionparameters x{i,j}, which are indexed by sets of size 2, i.e. where i, j ∈ {1, 2, 3, 4} , i 6= j. Off-diagonal entries of Q are obtained via qi,j = πj exp

(x{i,j}

), where

πj =exp (xj)∑4k=1 exp (xk)

.

We assign independent standard Gaussian priors on the parameters xi.We assume that a matrix ofaligned nucleotides is provided, where rows are species and columns contains nucleotides believed tocome from a shared ancestral nucleotide. Given x =

(x1, . . . , x4, x{1,2}, . . . , x{3,4}

), and hence Q,

the likelihood is a product of conditionally independent continuous time Markov chains (CTMC)over {A, C, G, T}, with “time” replaced by a branching process specified by the phylogenetic tree’stopology and branch lengths. The parameter x is unidentifiable, and while this can be addressed bybounded or curved parameterizations, the over-parameterization provides an interesting challengefor sampling methods, which need to cope with the strong induced correlations.

We analyze a dataset of primate mitochondrial DNA [10], containing 898 sites and 12 species. Wefocus on sampling x and fix the tree to a reference tree [13]. We use the basic BPS algorithm withrestricted refreshment and λref = 1 in conjunction with an auxiliary variable-based method similarto the one described in [30], alternating between two moves: (1) sampling CTMC paths along atree given x using uniformization, (2) sampling x given the path (in which case the derivation ofthe gradient is simple and efficient). The only difference compared to [30] is that we substitutethe HMC kernel by the kernel induced by running BPS. We use this auxiliary variable methodbecause conditioned on the paths, the energy is a convex function and hence we can use the methoddescribed in Example 1 to compute the bouncing times.

We compare against a state-of-the-art HMC sampler [28] that uses Bayesian optimization to adaptthe key parameters of HMC, the leap-frog stepsize ε and trajectory length L, while preservingconvergence to the correct target distribution. This sampler was shown to be comparable or betterto other state-of-the-art HMC methods such as NUTS. It also has the advantage of having efficientimplementations in several languages. We use the author’s Java implementation to compare toour 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 allexperiments, we initialize at the mode and use a burn-in of 100 iterations and no thinning. TheHMC auto-tuner yielded ε = 0.39 and L = 100. For our method, we use the global sampler andthe independent global refreshment scheme.

As a first step, we perform various checks to ensure that both BPS and HMC chains are in closeagreement given a sufficiently large number of iterations. We observe that after 20 millions HMCiterations, the highest posterior density intervals from the HMC method are in close agreementwith those obtained from BPS (result not shown) and that both method pass the Geweke diagnostic[8].

To compare the effectiveness of the two samplers, we first look at the ESS per second of the modelparameters. We show the maximum, median, and maximum over the 10 parameter components,for both BPS and HMC in Figure 11. As observed in Figure 12, the autocorrelation function(ACF) for the BPS decays faster than that of HMC. HMC’s slowly decaying ACF is due to thefact that the stepsize ε in HMC is selected to be very small by the auto-tuner.

To ensure that the problem does not come from a faulty auto-tuning, we look at the ESS/s for thelog-likelihood statistic when varying the stepsize ε. The results in Figure 13(right) show that thevalue selected by the auto-tuner is indeed reasonable, close to the value 0.02 found by brute forcemaximization. We repeat the experiments with ε = 0.02 and obtain the same conclusions. Thisshows that the problem is genuinely challenging for HMC.

21

Page 22: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

0.0

0.5

1.0

1.5

2.0

2.5

3.0

max median minstatistic (across parameters)

RF: ESS/s for different statistics

0.0

0.5

1.0

1.5

2.0

2.5

3.0

max median minstatistic (across parameters)

HMC: ESS/s for different statistics

Figure 11: Maximum, median and minimum ESS/s for BPS (left) and HMC (right). The experi-ments are replicated 10 times with different random seeds.

logDensity

0.0

0.4

0.8

0 10 20 30 40 50Lag

Aut

ocor

rela

tion

BPSlogDensity

0.0

0.4

0.8

0 10 20 30 40 50Lag

Aut

ocor

rela

tion

HMC

Figure 12: Estimate of the ACF of the log-likelihood statistic for BPS (left) and HMC (right). Asimilar behavior is observed for the ACF of the other statistics.

0.0

0.5

1.0

1.5

2.0

2.5

3.0

1e−06 1e−05 1e−04 0.001 0.01 0.1 1 10 100 1000refresh rate

BPS: ESS/s for different refresh rates

0.0

0.5

1.0

1.5

2.0

2.5

3.0

0.0025 0.005 0.01 0.02 0.04epsilon

HMC: ESS/s for different values of epsilon

Figure 13: Left: sensitivity of BPS’s ESS/s on the log likelihood statistic. Right: sensitivity ofHMC’s ESS/s on the log likelihood statistic. Each setting is replicated 10 times with differentalgorithmic random seeds.

22

Page 23: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

The BPS algorithm also exhibits sensitivity to λref . We analyze this dependency in Figure 13(left).We observe an asymmetric dependency, where values higher than 1 result in a significant drop inperformance, as they bring the sampler closer to random walk behavior. Values one or more ordersof magnitudes lower than 1 have a lower detrimental effect. However for a range covering six ordersof magnitudes, BPS outperforms HMC at its optimal parameters.

Acknowledgements

Alexandre Bouchard-Côté research is partially supported by a Discovery Grant from the NationalScience and Engineering Research Council. Arnaud Doucet’s research is partially supported by theEngineering and Physical Sciences Research Council, grants EP/K000276/1, EP/K009850/1. Se-bastian Vollmer’s research is partially supported by the grants EP/K009850/1 and EP/N000188/1.We thank Markus Upmeier for helpful discussions of differential geometry.

References

[1] R.J. Adler and J.E. Taylor. Topological Complexity of Smooth Random Functions, volume 2019of Lecture Notes in Mathematics. Springer, Heidelberg, 2011. École d’Été de Probabilités deSaint-Flour XXXIX.

[2] R. Bardenet, A. Doucet, and C. Holmes. Towards scaling up MCMC: An adaptive subsamplingapproach. In Proceedings of the 31st International Conference on Machine Learning, 2014.

[3] P. Bratley, B.L. Fox, and L.E. Schrage. A Guide to Simulation. Springer-Verlag, Berlin, 1983.

[4] Michael Creutz. Global Monte Carlo algorithms for many-fermion systems. Physical ReviewD, 38(4):1228–1237, 1988.

[5] L. Devroye. Non-uniform Random Variate Generation. Springer-Verlag, New York, 1986.

[6] M. Einsiedler and T. Ward. Ergodic Theory: with a view towards Number Theory, volume 259of Graduate Texts in Mathematics. Springer-Verlag, London, 2011.

[7] J.M. Flegal, J. Hughes, and D. Vats. mcmcse: Monte Carlo Standard Errors for MCMC,2015. R package version 1.1-2.

[8] J. Geweke. Evaluating the accuracy of sampling-based approaches to the calculation of pos-terior moments. Bayesian Statistics, 4:169–193, 1992.

[9] M. Hairer. Convergence of Markov processes. http://www.hairer.org/notes/Convergence.pdf, 2010. Lecture notes, University of Warwick.

[10] K. Hayasaka, Takashi G., and Satoshi H. Molecular phylogeny and evolution of primatemitochondrial DNA. Molecular Biology and Evolution, 5:626–644, 1988.

[11] M.D. Hoffman and A. Gelman. The no-U-turn sampler: Adaptively setting path lengths inHamiltonian Monte Carlo. Journal of Machine Learning Research, 15(4):1593–1623, 2014.

[12] Alan M Horowitz. A generalized guided Monte Carlo algorithm. Physics Letters B, 268(2):247–252, 1991.

[13] J.P. Huelsenbeck and F. Ronquist. MRBAYES: Bayesian inference of phylogenetic trees.Bioinformatics, 17(8):754–755, 2001.

[14] T. S. Jaakkola and M. I. Jordan. Bayesian logistic regression: a variational approach. Statisticsand Computing, 10:25–37, 2000.

23

Page 24: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

[15] T.A. Kampmann, H.H. Boltz, and J. Kierfeld. Monte Carlo simulation of dense polymer meltsusing event chain algorithms. Journal of Chemical Physics, (143):044105, 2015.

[16] J. S. Liu. Monte Carlo Strategies in Scientific Computing. Springer, 2008.

[17] D. Maclaurin and R.P. Adams. Firefly Monte Carlo: Exact MCMC with subsets of data. InUncertainty in Artificial Intelligence, volume 30, pages 543–552, 2014.

[18] M. Manon, S.C. Kapfer, and W. Krauth. Generalized event-chain Monte Carlo: Constructingrejection-free global-balance algorithms from infinitesimal steps. Journal of Chemical Physics,140(5):054116, 2014.

[19] M. Manon, J. Mayer, and W. Krauth. Event-chain Monte Carlo for classical continuous spinmodels. Europhysics Letters, (112):20003, 2015.

[20] R.M. Neal. Markov chain Monte Carlo using Hamiltonian dynamics. In Handbook of MarkovChain Monte Carlo. Chapman & Hall/CRC, 2011.

[21] Y. Nishikawa, M. Manon, W. Krauth, and K. Hukushima. Event-chain Monte Carlo algorithmfor the Heisenberg model. Physical Review E, (92):063306, 2015.

[22] E.A. J. F. Peters and G. de With. Rejection-free Monte Carlo sampling for general potentials.Physical Review E, 85:026703, 2012.

[23] G. O. Roberts and J.S. Rosenthal. Optimal Scaling for Various Metropolis-Hastings Al-gorithms. Statistical Science, 16(4):351–367, 2001.

[24] S. Tavaré. Some probabilistic and statistical problems in the analysis of DNA sequences.Lectures on Mathematics in the Life Sciences, 17:56–86, 1986.

[25] Y. W. Teh, A. H. Thiéry, and S. J. Vollmer. Consistency and fluctuations for stochasticgradient Langevin dynamics. Journal of Machine Learning Research, 2015.

[26] V.H. Thanh and C. Priami. Simulation of biochemical reactions with time-dependent ratesby the rejection-based algorithm. Journal of Chemical Physics, 143(5):054104, 2015.

[27] M.J. Wainwright and M.I. Jordan. Graphical models, exponential families, and variationalinference. Foundations and Trends in Machine Learning, 1(1-2):1–305, 2008.

[28] Z. Wang, S. Mohamed, and N. De Freitas. Adaptive Hamiltonian and Riemann manifoldMonte Carlo. In Proceedings of the 30th International Conference on Machine Learning,pages 1462–1470, 2013.

[29] M. Welling and Y. W. Teh. Bayesian learning via stochastic gradient Langevin dynamics. InProceedings of the 28th International Conference on Machine Learning, pages 681–688, 2011.

[30] T Zhao, Z. Wang, A. Cumberworth, J. Gsponer, N. De Freitas, and A. Bouchard-Côté.Bayesian analysis of continuous time Markov chains with application to phylogenetic model-ling. Bayesian Analysis, 2015.

A Proofs of Section 2

A.1 Proof of invariance w.r.t ρ

Let µt be the law of z (t). In the following, we prove invariance by explicitly verifying that thetime evolution of the density dµt

dt = 0 is zero if the initial distribution µ0 is given by (12). Thisis achieved by deriving the forward Kolmogorov equation describing the evolution of the marginaldensity of the stochastic process. For simplicity, we start by presenting the invariance argumentwhen λref = 0.

24

Page 25: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

Notation and description of the algorithm. We denote a pair of position and velocity byz = (x, v) ∈ Rd × Rd and we denote translations by Φt(z) = (Φpos

t (z),Φdirt (z)) = (x+ vt, v). The

time of the first bounce coincides with the first arrival T1 of an inhomogeneous Poisson processwith intensity χ(t) = λ(Φt(z)) where:

λ(z) = max {0, 〈∇U (x) , v〉} . (18)

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

Not(z) = exp

(−ˆ t

0

λ(Φs(z))ds

), (19)

and the density of the random variable T1 is given by:

q(t1; z) = 1[t1 > 0] ddt1

(1−Not1(z)) (20)= 1[t1 > 0]Not1(z)λ(Φt1(z)). (21)

If a bounce occurs, then the algorithm follows a translation path for time T1, at which point thevelocity is updated using a bounce operation C(z), defined as:

C (z) = (x,R (x) v) (22)

whereR (x) v = v − 2

〈∇U (x) , v〉∇U (x)

‖∇U (x)‖2. (23)

The algorithm then continues recursively for time t− T1, in the following sense: a second bouncetime T2 is simulated by adding to T1 a random increment with density q(·;C ◦ Φt1(z)). If T2 > t,then the output of the algorithm is Φt−t1 ◦C ◦Φt1(z), otherwise an additional bounce is simulated,etc. More generally, given an initial point z and a sequence t = (t1, t2, . . . ) of bounce times, theoutput of the algorithm at time t is given by:

Ψt,t (z) =

{Φt(z) if t1 > 0 or t = ( ),

Ψt′,t−t1 (z) ◦ C ◦ Φt1(z) otherwise,(24)

where ( ) denotes the empty list and t′ the suffix of t: t′ = (t2, t3, . . . ). As for the bounce times,they are distributed as follows:

T1 ∼ q( · ; z) (25)

Ti − Ti−1|T1:i−1 ∼ q(· ; ΨT1:i−1,Ti−1

(z)︸ ︷︷ ︸Pos. after collision i− 1

), i ∈ {2, 3, 4, . . . } (26)

where T1:i−1 = (T1, T2, . . . , Ti−1) .

Decomposition by the number of bounces. Let h denote an arbitrary non-negative meas-urable test function. We show how to decompose expectations of the form E[h(ΨT,t(z))] by thenumber of bounces in the interval (0, t). To do so, we introduce a function #Colt(t), which returnsthe number of bounces in the interval (0, t):

#Colt(t) = min {n ≥ 1 : tn > t} − 1. (27)

From this, we get the following decomposition:

E[h(ΨT,t(z))] = E[h(ΨT,t(z))

∞∑n=0

1[#Colt(T) = n]] (28)

=

∞∑n=0

E[h(ΨT,t(z))1[#Colt(T) = n]]. (29)

25

Page 26: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

On the event that no bounce occurs in the interval [0, t), i.e. #Colt(T) = 0, the function ΨT,t(z)is equal to Φt(z), therefore:

E[h(ΨT,t(z))1[#Colt(T) = 0]] = h(Φt(z))P(#Colt(T) = 0) (30)= h(Φt(z))Not(z). (31)

Indeed, on the event that n ≥ 1 bounces occur, the random variable h(Φt(z)) only depends on afinite dimensional random vector, (T1, T2, . . . , Tn), so we can write the expectation as an integralwith respect to the density q(t1:n; t, z) of these variables:

E[h(ΨT,t(z))1[#Colt(T) = n]] (32)= E

[h(ΨT,t(z))1[0 < T1 < · · · < Tn < t < Tn+1]

]=

ˆ· · ·ˆ

0<t1<···<tn<t<tn+1h(Ψt1:n,t(z))q(t1; z)

n+1∏i=2

q(t− ti−1; Ψt1:i−1,ti−1 (z))dt1:n+1

=

ˆ· · ·ˆ

0<t1<···<tn<th(Ψt1:n,t(z))q(t1:n; t, z)dt1:n, (33)

where:

q(t1:n; t, z) = q(t1; z)×

{Not−t1(Φt1(z)) if n = 1

Not−tn(Φt1:n,tn(z))∏ni=2 q

(ti − ti−1; Ψt1:i−1,ti−1(z)

)if n ≥ 2.

To include Equations (31) and (33) under the same notation, we define t1:0 to the empty list, ( ),q(( ); t, z) = Not(z), and abuse the integral notation so that for all n ∈ {0, 1, 2, . . . }:

E[h(ΨT,t(z))1[#Colt(T) = n]] =

ˆ· · ·ˆ

0<t1<···<tn<t h(Ψt1:n,t(z))q(t1:n; t, z)dt1:n. (34)

Marginal density. Let us fix some arbitrary time t > 0. We seek a convenient expression forthe marginal density at time t, µt(z), given an initial vector Z ∼ ρ, where ρ is the hypothesizedstationary density (12) on Z. To do so, we look at the expectation of an arbitrary non-negativemeasurable test function h:E[h(ΨT,t(Z))] = E

[E[h(ΨT,t(Z))|Z]

](35)

=

∞∑n=0

E[E[h(ΨT,t(Z))1[#Colt(T) = n]|Z]

](36)

=

∞∑n=0

ˆZρ(z)

ˆ· · ·ˆ

0<t1<···<tn<th(Ψt1:n,t(z))q(t1:n; t, z)dt1:ndz (37)

=

∞∑n=0

ˆ· · ·ˆ

0<t1<···<tn<t

ˆZρ(z)h(Ψt1:n,t(z))q(t1:n; t, z)dzdt1:n (38)

=

∞∑n=0

ˆ· · ·ˆ

0<t1<···<tn<t

ˆZρ(Ψ−1

t1:n,t(z′))h(z′)q(t1:n; t,Ψ−1

t1:n,t(z′))

∣∣∣detDΨ−1t1:n,t

∣∣∣dz′dt1:n=

ˆZh(z′)

∞∑n=0

ˆ· · ·ˆ

0<t1<···<tn<tρ(Ψ−1t1:n,t

(z′))q(t1:n; t,Ψ−1t1:n,t

(z′))dt1:n︸ ︷︷ ︸µt(z′)

dz′. (39)

We used the following in the above derivation successively the law of total expectation, equa-tion (29), equation (35), Tonelli’s theorem and the change of variables, z′ = Ψt1:n,t(z), justifiedsince for any fixed 0 < t1 < t2 < · · · < tn < t < tn+1, Ψt1:n,t(·) is a bijection (being a compositionof bijections). Now the absolute value of the determinant is one since Ψt,t (z) is a compositionof unit-Jacobian mappings and, by using Tonelli’s theorem again, we obtain that the expressionabove the brace is necessarily equal to µt(z′) since h is arbitrary.

Derivative. Our goal is to show that for all z′ ∈ Z

dµt(z′)

dt= 0.

26

Page 27: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

Since the process is time homogeneous, once we have computed the derivative, it is enough to showthat it is equal to zero at t = 0. To do so, we decompose the computation according to the termsIn in Equation (39):

µt(z′) =

∞∑n=0

In(z′, t) (40)

In(z′, t) =

ˆ· · ·ˆ

0<t1<···<tn<tρ(Ψ−1t1:n,t(z

′))q(t1:n; t,Ψ−1t1:n,t(z

′))dt1:n. (41)

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

No bounce: n = 0, Ψt1:n,t(z) = Φt(z), or,

Exactly one bounce: n = 1, Ψt1:n,t(z) = Ft,t1 := Φt−t1 ◦ C ◦ Φt1(z) for some t1 ∈ (0, t), or,

Two or more bounces: n ≥ 2, Ψt1:n,t(z) = Ψt−t2 ◦ C ◦ Ft2,t1(z) for some 0 < t1 < t2 < t

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

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

I0(z′, t) = ρ(Φ−t(z′))Not(Φ−t(z

′)). (42)

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

d

dtI0(z′, t)

∣∣∣∣t=0

= No0 (Φ0(z′))dρ(Φ−t(z

′))

dt

∣∣∣∣t=0

+

ρ(Φ0(z′))dNot(Φ−t(z

′))

dt

∣∣∣∣t=0

(43)

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

No0(Φ0(z′))dρ(Φ−t(z

′))

dt=

dρ(Φ−t(z′))

dt(44)

=

⟨∂ρ(Φ−t(z

′))

∂Φpos−t (z′)

,dΦpos−t (z′)

dt

⟩+⟨

∂ρ(Φ−t(z′))

∂Φdir−t(z

′),

dΦdir−t(z

′)

dt︸ ︷︷ ︸=0

⟩(45)

=

⟨∂ρ(z)

∂x,−v′

⟩(46)

=

⟨∂

∂x

1

Zexp (−U(x))ψ (v) ,−v′

⟩= ρ(Φ−t(z

′)) 〈∇U(x), v′〉 , (47)

where x = Φpos−t (z′). The second term in Equation (43) is equal to:

ρ(Φ0(z′))dNot(Φ−t(z

′))

dt

∣∣∣∣t=0

= −ρ(Φ0(z′))No0(z′)λ(Φ0(z′)) (48)

= −ρ(z′)λ(z′), (49)

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

d

dtI0(z′, t)

∣∣∣∣t=0

= ρ(z′) 〈∇U(x′), v′〉 − ρ(z′)λ(z′).

27

Page 28: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

Exactly one bounce in the interval. From Equation (33), the trajectory consists in a bounceat a time T1, occurring with density (expressed as before as a function of the final point z′)q(t1;F−1

t,t1(z′)), followed by no bounce in the interval (T1, t], an event of probability:

Not−t1(C ◦ Φt1(z)) = Not−t1(C ◦ Φt1 ◦ F−1t,t1(z′)) (50)

= Not−t1(Φt1−t(z′)), (51)

where we used that C−1 = C. This yields:

I1(z′, t) =

ˆ t

0

q(t1;F−1t,t1(z′))ρ(Ψ−1

t1:1,t(z′))Not−t1(Φt1−t(z

′))dt1. (52)

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

d

dtI1(z′, t)

∣∣∣∣t=0

= ρ(C(z′))λ(C(z′)).

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

In(z′, t) =

ˆ t0

[ ˆ· · ·ˆt2:n:t1<t2···<tn<tρ(Ψ−1

t1:n,t(z′))q(t1:n; t,Ψ−1

t1:n,t(z′))dt2:n︸ ︷︷ ︸

I(t1,t,z′)

]dt1, (53)

and hence, using Leibniz’s rule on the integral over t1:

d

dtIn(z′, t)

∣∣∣∣t=0

= I(0, 0, z′) = 0. (54)

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

dµt(z′)

dt

∣∣∣∣t=0

= ρ(z′) 〈∇U(x′), v′〉−ρ(z′)λ(z′) + ρ(C(z′))λ(C(z′)).︸ ︷︷ ︸ (55)

From the expression of λ(·), we can rewrite the two terms above the brace as follows:

− ρ(z′)λ(z′) + ρ(C(z′))λ(C(z′))

=− ρ(z′)λ(z′) + ρ(z′)λ(C(z′))

=− ρ(z′) max{0, 〈∇U(x′), v′〉}+ ρ(C(z′)) max{0, 〈∇U(x′), R (x′) v′〉}=− ρ(z′) max{0, 〈∇U(x′), v′〉}+ ρ(z′) max{0, 〈∇U(x′), R (x′) v′〉}=− ρ(z′) max{0, 〈∇U(x′), v′〉}+ ρ(z′) max{0,−〈∇U(x′), v′〉}=− ρ(z′) 〈∇U(x′), v′〉 ,

where we used that ρ(z′) = ρ(C(z′)), 〈∇U(x′), R (x′) v′〉 = −〈∇U(x′), v′〉 and max{0,−f} =

−max{0, f} for any function f . Hence we have dµt(z′)

dt

∣∣∣t=0

= 0, establishing that that the bouncy

particle sampler λref = 0 admits ρ as invariant distribution. The invariance for λref > 0 thenfollows from Lemma 1 given below.

Lemma 1. Suppose Pt is a continuous time Markov kernel and Q is a discrete time Markov kernelwhich are both invariant with respect to µ. Suppose we construct for λref > 0 a Markov process Ptas follows: at the jump times of an independent Poisson process with intensity λref we make atransition with Q and then continue according to Pt, then Pt is also µ-invariant.

Proof. The transition kernel is given by

Pt = e−λtPt +

ˆ t

0

dt1λeλt1e−λ(t−t1)Pt−t1QPt1

+

ˆ t

0

dt1

ˆ t2

t1

dt2λ2eλt1eλ(t2−t1)e−λ(t−t2)Pt−t2QPt2−t1QPt1 + . . .

28

Page 29: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

Therefore

µPt = µ

(e−λt + λte−λt +

(λt)2

2e−λt . . .

)= µ.

Hence Pt is µ-invariant.

Infinitesimal generator and irreversibility.

Next, an argument similar to the proof of π-invariance without refreshment yields the followingexpression for the generator of the process with refreshment:

E [h(x (t) , v (t))| (x (0) , v (0)) = (x, v)] (56)

= exp

(−ˆ t

0

(λ0(s) + λref

)ds

)h(x+ tv, v)

+

ˆ t

0

dt1(λ0(t1) + λref

)· λref

λ0(t1) + λrefexp

(−ˆ t1

0

(λ0(s1) + λref

)ds1

)ˆψ(dv1) exp

(−ˆ t

t1

(λ1(s2) + λref

)ds2

)h(x+ t1v + (t− t1)v1) +ˆ t

0

λ0(t1) exp

(−ˆ t1

0

(λ0(s1) + λref

)ds1

)ˆRdδv− 2〈∇U,v〉‖∇U‖2

v(dv1) exp

(−ˆ t

t1

(λ1(s2) + λref

)ds2

)h(x+ t1v + (t− t1)v1)

+ . . .

where λ0(s) = max {0, 〈∇U(x+ sv), v〉} and λ1(s) = max {0, 〈∇U(x+ t1v + (s− t1)v1), v1〉} arethe intensity of bounces. Here we used that a Poisson process with rate λ0(t1) + λref have bouncewith probability λ0(t1)

λ0(t1)+λref and refreshment with probability λref

λ0(t1)+λref . From this we can concludethat for (x (0) , v (0)) = (x, v)

Lh = limt→0

E [h(x (t) , v (t))| (x (0) , v (0)) = (x, v)]− h(x, v)

t= − (max {0, 〈∇U(x), v〉})h(x, v) + 〈∇xh, v〉

+λref

ˆψ(dv′) (h(x, v′)− h(x, v)) + max {0, 〈∇U(x), v〉}h(x,R(x)v).

A simple calculation shows that

ˆdzρ ((Lh) g − (Lg)h) =

ˆdzρ(z)

(h(x, v − 2 〈∇U, v〉

‖∇U‖2v)g − hg

)〈∇U(x), v〉 .

Generally, the above expression is not equal to zero, hence the stochastic process is not reversible.

A.2 Ergodicity

We denote by P reft(z,dz

′) the transition kernel of the continuous-time Markov process corres-ponding to the potential U = 0, that is we consider the process without bounces based purely onrefreshments at constant rate. We will compare P ref

t to P t in order to show that ρ is the uniqueinvariant distribution of P t. We fix t0 > 0 and consider the embedded discrete time chain P ref

nt0 .In the following, BR (x)denotes the Euclidean ball of radius R centered at x. Our proof relies onthe following preliminary lemma.

Lemma 2. P reft0 satisfies that

1. for all t0 > 0, z = (x, v) ∈ Rd × Rd and open set W ⊂ Rd × Rd there exists n ∈ {1, 2, 3, . . . }such that P ref

nt0(z,W ) > 0

29

Page 30: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

2. For all ε > 0 there exists δ > 0 and t0 > 0 such that for any x0 ∈ Rd and any (x, v) ∈Bε(x0)×B1(0),

P reft0 ((x, v),d (x′, v′)) ≥ δ1Bε(x0)×B1(0) (dx, dv) . (57)

Proof of Lemma 2. We only prove 2) as 1) can be established in a similar way. Let h be a positivetest function. The aim is to show that for z ∈ Bε(x)×B1(0)

P refth(z) ≥ δ

ˆBε(x0)×B1(0)

h(z′)dz′. (58)

We pick t = 4ε and obtain a non explicit lower bound for δ. The transition kernel P reft (z,dz′) is

bounded from below by considering the transition due to exactly two refreshments, that is

P reftg(z) ≥

ˆ{0<t1,t2< ε

2 ,t1+t2<t}dt1dt2

ˆRdψ(dv1)

ˆRdψ(dv2)

λref2 exp(−λreft

)h (x+ t0v + t1v1 + (t− t1 − t0)v2, v2) . (59)

To obtain a lower bound as in Equation (57), we use the co-area formula.

For C1 Riemannian manifolds M and N of dimension m and n and a differentiable map F and ha test function, we have

ˆM

h(w)JF (w)dHm(w) =

ˆN

dHn(u)

ˆF−1(u)

dHm−n(x)h(x),

ˆM

h(F (w))

JF (w)JF (w)dHm(w) =

ˆN

dHn(u)h(u)

ˆF−1(u)

dHm−n(x)1

JF (x),

see e.g. Section 3.2 of [1]. Here Hm, Hn and Hm−n denote the volume measures associated withRiemannian metric on M , N and F−1(u) (with the induced metric of M). In the above equations,JF is a generalization of the determinant of the Jacobian JF :=

√det gt(∇fi,∇fj) where g is the

corresponding Riemannian metric, see [1]. Here JF=√

detDF ′ DF . Applying the statement toEquation (59) with M =

{0 < t1, t2 <

ε2 , t1 + t2 < t

}× Rd × Rd and N = Rd × Rd,

P reftg(z) ≥ λref2 exp

(−λreft

)ˆh (z2) dz2ˆ

F−1t,x0,v0

(z2)∩MdH(t1, t2, v1, v2)ψ(v1)

ˆRdψ(v2)

1

JFt,x0,v0(t1, t2, v1, v2).

with

Ft,x0,v0(t0, v1, t1, v2) : = (x0 + t0v0 + t1v1 + (t− t1 − t0)v2, v2) .

DFt,x0,v0 =

(v0 t1I v1 − v2 (t− t0 − t1) I0 0 0 I

)JFt,x0,v0 =

√detDFt,x0,v0DF

tt,x0,v0 .

Notice that F−1t,x0,v0(z2) 6= ∅ because {t0, v1, t1, v2} ∈ F−1

t,x0,v0(z2) for 0 < t0 <ε2 , t1 < t − t0 − ε

2

and v1 = (x2−(t−t0−t1)v2)−(x0+t0v0)t1

.

The statement can now be verified by showing that

infz,z2

ˆF−1z (z2)∩M

dH(t1, t2, v1, v2)1

JF (t1, t2, v1, v2)> 0,

which follows from the fact that DFt,x0,v0 has full rank on M.

30

Page 31: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

Proof of Theorem 1. Suppose BPS is not ergodic, then it follows from standard results in ergodictheory that there are two measures µ1 and µ2 such that µ1 ⊥ µ2 and µiPt0 = µi, see e.g. [9]. Thusthere is a set A such that

µ1(A) = µ2(Ac) = 0 (60)

Because of the first part of Lemma 2 and Lemma 2.2 of [9] the support of the µi is Rd×Rd. Thus

∞ > µi (Bε(0)×B1(0)) > δ > 0

and we have by invariance

µi(dz) =

ˆµi (dz)Pt0(z,dz)

≥ˆBε(0)×B1(0)

µi (dz) exp

(−t0 sup

w∈B2ε(0)

‖∇U(w)‖

)P ref

t0(z,dz)

≥ 1Bε(0)×B1(0)δ exp

(− supw∈B2ε(0)

‖∇U(w)‖

)dz, (61)

where the last step follows by Lemma 2 for some δ > 0. That contradicts the fact that µ1 ⊥ µ2.

The law of large numbers then follows by Birkhoff’s pointwise ergodic theorem; see e.g. [6, Theorem2.30, Section 2.6.4].

A.3 Local Sampler

In the following we adapt the computations of Appendix A.1 to show invariance for the localsampler. Similar to the basic BPS it is sufficient to compute I0 and I1 given in (42) and (52)because the higher order terms have a vanishing derivative. The local sampler can be realizedby considering the global events Q, see Algorithm 4, as coming from a Poisson process withintensity λg =

∑f∈F λf a bounce event at time t is then associated with factor f with probability

λf (z(t))∑f∈F λf (z(t)) .

We obtain for the term I0 corresponding to no bounce happening

ρ (Φ−t (z′))Not (Φ−t(z′)) ,

where Nogt (Φ−t (z)) where is the probability that no bounce happens on [0, t] when started at z,

that is

Not (Φ−t (z)) = exp

(−ˆ t

0

Φs (z) ds

).

We now evaluate the time derivative at zero of I0 (z′, t)

d

dtI0 (z′, t) |t=0= ρ (z′) 〈∇U(x), v〉 − ρ(z′)λg (z′) .

The term I1 (z, t) is obtained by performing a change of coordinates

E[E[h(z (t))1#Colt(T )=1

∣∣ z (0) = z]]

=

ˆ t

0

dt1

ˆdzρ(z)

∑f ′∈F

(λf ′ ◦ Φt1) (z)

Not−t1(Cf ◦ Φt1(z))∑f∈F

(λf ◦ Φt1) (z)∑f ′∈F (λf ′ ◦ Φt1) (z)

· (h ◦ Φt−t1 ◦ Cf ◦ Φt1) (z)

=∑f∈F

ˆ t

0

dt1

ˆdzρ (z)Not−t1(Cf ◦ Φt1(z))λf (h ◦ Φt−t1 ◦ Cf ◦ Φt1) (z),

31

Page 32: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

whereCf ((x, v)) = (x,Rf (x)v) .

Performing a change of coordinates for each of the terms and the sum, we obtain

d

dtI1 (z′, t) |t=0=

∑f∈F

ρ(Cf (z′))λ(Cf (z′)).

Thus, we obtain overall

d

dtµt(z

′) |t=0= ρ (z′)∑f∈F

〈∇Uf (x), v〉−ρ(z′)∑f∈F

max {0, 〈∇Uf , v〉}+∑f∈F

ρ(Cf (z′))∑f∈F

max {0,−〈∇Uf , v〉}

Inserting ρ from Equation (12), we obtain ddtµt |t=0= 0.

B Bayesian logistic regression

B.1 Bounds on the intensity

We derive here a datapoint-specific upper bound χ[r] to χ[r](t). First, we need to compute thegradient for one datapoint:

∇U [r](x) = ιr(logistic 〈ιr, x〉 − cr),

where:logistic(a) =

ea

1 + ea.

We then consider two sub-cases depending on cr = 0 or cr = 1. Suppose first cr = 0, and letx(t) = x+ tv

χ[r](t) = max{0, 〈∇Ur(x(t)), v〉}

= max

{0,

d∑k=1

ιr,kvklogistic 〈ιr, x(t)〉

}

≤d∑k=1

1[vk > 0]ιr,kvklogistic 〈ιr, x(t)〉

≤d∑k=1

1[vk > 0]ιr,kvk︸ ︷︷ ︸χ[r]

The bound makes sense intuitively: it the true label is cr = 0, then to correctly label this datapoint,for the dimensions where ιr,k is large, we need small values of xk. This means we want the bouncingrate to increase with the velocity for such dimension.

32

Page 33: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

Similarly, for cr = 1:

χ[r](t) = max

{0,

d∑k=1

ιr,kvk(logistic 〈ιr, x(t)〉 − 1)

}

= max

{0,

d∑k=1

ιr,k(−vk)(1− logistic 〈ιr, x(t)〉)

}

≤d∑k=1

1[vk < 0]ιr,k(−vk)(1− logistic 〈ιr, x(t)〉)

=

d∑k=1

1[vk < 0]ιr,k|vk|(1− logistic 〈ιr, x(t)〉)

≤d∑k=1

1[vk < 0]ιr,k|vk|︸ ︷︷ ︸χ[r]

Combining these we obtain:

χ[r] =

d∑k=1

1[vk(−1)cr ≥ 0]ιr,k|vk|.

When implementing Algorithm 6, we need to bound∑Rr=1 χ

[r](t). We have

χ =

R∑r=1

χ[r] ≥R∑r=1

χ[r](t)

=

R∑r=1

d∑k=1

1[vk(−1)cr ≥ 0]ιr,k |vk|

=

d∑k=1

|vk|R∑r=1

1[vk(−1)cr ≥ 0]ιr,k

=

d∑k=1

|vk| ι1[vk<0]k .

B.2 Sampling the thinned factor

We show here how to implement Step 5(d)i of Algorithm 6 without enumerating over the Rdatapoints. 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(R logR)is considered negligible (the number of bouncing events is assumed to be greater than R). Foreach dimensionality k and class label c, consider the categorical distribution with the followingprobability mass function over the datapoints:

µck(r) =ιr,k1[cr = c]

ιck.

This is just the distribution over the datapoints that have the given label, weighted by the covariatek. An alias sampling data-structure [5, Section 3.4] is computed for each k and c. This pre-computation takes total time O(R logR). This allows subsequently to sample in time O(1) fromthe distributions µck.

33

Page 34: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

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

q(r) =χ[r]

χ.

To do this sampling efficiently, we construct an artificial joint distribution over both datapointsand covariate dimension indices:

q(r, k) =1[vk(−1)cr ≥ 0]ιr,k |vk|

χ.

We denote by qk(k), respectively qr|k(r|k), the associated marginal, respectively conditionaldistribution. By construction, we have

d∑k=1

q(r, k) = q(r).

It is therefore enough to sample (r, k) and to return r. To do so, we first sample (a) k ∼ qk(k) andthen (b) sample r|k ∼ qr|k(r|k).

For (a), we have:

qk(k) =|vk| ι1[vk<0]

k

χ,

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

For (b), we have:qr|k(r|k) = µ

1[vk<0]

k(r),

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

B.3 Algorithm description

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

34

Page 35: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

Algorithm 7 Local BPS algorithm for Logistic Regression with Large Datasets

1. Precompute the alias tables µck(r) for k = 1, . . . , d, c ∈ {0, 1}.

2. Initialize the state and velocity(x(0), v(0)

)arbitrarily on Rd × Rd.

3. Initialize the global clock T ← 0.

4. Initialize T ←4.

5. Compute local-in-time upper bound on the prior factor as χprior =σ−2

2 max(0,⟨x(0) + ∆v(0), v(0)

⟩)(notice the rate associated with the prior is monoton-

ically increasing).

6. While more events i = 1, 2, . . . requested do

(a) Compute the datapoint-specific upper bound in O(d)

χ[r] =

d∑k=1

1[vk(−1)cr ≥ 0]ιr,k|vk|.

(b) Sample τ ∼ Exp(χprior + χ[r] + λref

).

(c) Set T ← T + τ .

(d) If(T > T

)then

i. x(i) ← x(i−1) + (T − T )v(i−1),ii. v(i) ← v(i−1).iii. Compute local-in-time upper bound for the prior.iv. Set T ← T , T← T +4.

(e) Else

i. Sample j from Discrete( χ[r]

χprior +χ[r]+λref ,λref

χprior +χ[r]+λref ,χprior

χprior +χ[r]+λref ) .ii. If j = 1

A. x(i) ← x(i−1) + v(i−1)τ .B. Sample k according to qk(k).C. Sample r ∼ qr|k(r) using the precomputed alias table.

D. If V <max(0,〈∇U [r](x),v〉)

χ[r] where V ∼ U (0, 1) .v(i) ← Rr(x)v(i−1) where Rr is the collision operator associated with the r-thdata item .Else v(i) ← v(i−1).

iii. If j = 2

A. x(i) ← x(i−1) + v(i−1)τ .B. v(i) ∼ N (0d, Id).

iv. If j = 3

A. x(i) ← x(i−1) + v(i−1)τ .

B. If V <σ−2

2 max(〈x(i−1)+τv(i−1),v(i−1)〉,0)χprior

where V ∼ U (0, 1).v(i) ← Rprior(x)v(i−1) where Rprior is collision operator associated with prior.Else v(i) ← v(i−1).

v. Compute local-in-time upper bound for the prior.

35

Page 36: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

C Calculations of Section 4.1 and proof of Proposition 2

C.1 Calculations of the norms at bounce times in the isotropic normalcase

From Equation (6), we have⟨x(i), v(i)

⟩=

⟨x(i−1) + τiv

(i−1), v(i−1) −2⟨x(i−1) + τiv

(i−1), v(i−1)⟩∥∥x(i−1) + τiv(i−1)

∥∥2

(x(i−1) + τiv

(i−1))⟩

=⟨x(i−1), v(i−1)

⟩+ τi − 2

⟨x(i−1) + τiv

(i−1), v(i−1)⟩

= −⟨x(i−1), v(i−1)

⟩− τi

=

{−√− log Vi if

⟨x(i−1), v(i−1)

⟩≤ 0

−√⟨

x(i−1), v(i−1)⟩2 − log Vi otherwise

,

and we can obtain easily the expression for∥∥x(i)

∥∥2shown in 4.1.

C.2 Proof of Proposition 2

The dynamics of the BPS can be lumped into a two dimensional Markov process involving only theradius rt = ‖x (t)‖ and mt = 〈x (t) , v (t)〉 / ‖x (t)‖ for any dimensionality d ≥ 2. The variable mcan be interpreted (via arccos(m)) as the angle between the particle position and velocity. Becauseof the strong Markov property we take τ1 = 0 without loss of generality and let t be some timebetween the current event and the next, yielding:

rt =√〈x (0) + v (0) · t, x (0) + v (0) · t〉 =

√r20 + 2t0m (0) r0 + t2 (62)

mt =〈x (0) + v (0) · t, v (0)〉‖x (0) + v (0) · t‖

=r0m (0) + t

rt

If there is a bounce at time t, then

R′t = Rt

M ′t = −M t. (63)

The bounce happens with intensity λ(x + tv, v) = max (0, 〈x, v〉+ t). These processes can alsobe written as an stochastic differential equation (SDE) driven by a jump process whose intensityis coupled to its position. This is achieved by writing the deterministic dynamics given in (62)between events as the following ordinary differential equation (ODE):

d

dtrt =

2mtrt2rt

= mt

d

dtmt =

rt − (rtmt)mt

(rt)2 =

1− (mt)2

rt.

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

dRt =2M tRt

2Rt= M t

dM t =1−M2

t

Rtdt− 2M t dNt (64)

where Nt is the counting process associated with Πt the inhomogeneous Poisson process withintensity max (0, Rt ·M t).

Now consider the push forward measure ofN(0, 1

2Ik)⊗U(Sk−1) under the map (x, v) 7→ (‖x‖ , 〈x, v〉 / ‖x‖)

where U(Sk−1) is the uniform distribution on Sk−1. This yields the collection of measures withdensities fk(r,m). It is easy to check that fk(r,m) is invariant for (64) for all k ≥ 2.

36

Page 37: arXiv:1510.02451v3 [stat.ME] 27 Jan 2016 · intensity ref 0, ref being a parameter of the BPS algorithm. Throughout the paper, we use Throughout the paper, we use the terminology

C.3 Markov chain on the events

To facilitate this investigation, we first use Equations (62) and (63) to obtain a discrete timeMarkov chain on the events. An algorithm to perform this simulation is shown in Algorithm 8.

Algorithm 8 Event Chain for isotropic Gaussian target distributions.

1. Set R0 ← 0 and M0 ← 0

2. For i = 1, . . . , n

(a) Simulate bi ∼ Exp(1), τrefi ∼ Exp(1), Yi ∼ Beta(d−12 , d−1

2 )

(b) Set τci ←

{−M i−1 +

√bi for M i−1 ≤ 0

−M i−1 +√M2

i−1 + bi otherwise

(c) If τci ≤ τrefi

• Ri ←√R2i−1 + 2τciM i−1Ri−1 + τc2

• M i ←

{−√biRi

M i−1 < 0

−√bi+M2

i−1R2i−1

Ri

(d) Else

• Ri ←√R2i−1 + 2τrefiM i−1Ri−1 + τrefi

• M i ← 2Yi − 1

37