Path storage in the particle filter

Pierre E. Jacob, Lawrence Murray, Sylvain Rubenthaler

Introduction

Consider the problem of filtering in state-space models (Cappé et al, 2005) defined by X0∼μ(⋅)X_{0}\sim\mu(\cdot) and for t=1,…,Tt=1,\ldots,T

Here X0:TX_{0:T} is a hidden Markov chain in some space X\mathcal{X} with initial distribution μ\mu and transition density ff. The observations Y1:TY_{1:T} in space Y\mathcal{Y} are conditionally independent given x1:Tx_{1:T}, with measurement density gg. For any vector vv, introduce the notation v1:n=(v1,…,vn)v_{1:n}=(v_{1},\ldots,v_{n}) and v1:n=(v1,…,vn)v^{1:n}=(v^{1},\ldots,v^{n}).

We denote by ptp_{t} the distribution of the path X0:tX_{0:t} given the observations y1:ty_{1:t} available at time tt, from which the filtering distribution of XtX_{t} given y1:ty_{1:t}, denoted by πt\pi_{t}, is a marginal. The bootstrap particle filter (Gordon et al, 1993), described in Algorithm 1, recursively approximates the distributions p1:Tp_{1:T}, and has borne various other sequential Monte Carlo methods (Doucet et al, 2001; Doucet and Johansen, 2011).

In Algorithm 1 the resampling step relies on some distribution R\mathcal{R} on {1,…,N}N\{1,\ldots,N\}^{N} taking normalized weights as parameters.

At each time tt, Algorithm 1 approximates ptp_{t} and πt\pi_{t} by the empirical distributions

It has been shown in Whiteley (2011); Douc et al (2012); van Handel (2009), and in Theorem 7.4.4 in Del Moral (2004) that πtN\pi_{t}^{N} converges to πt\pi_{t} with NN under mild conditions on the model laws (μ,f,g)(\mu,f,g), and that the Monte Carlo error is constant with respect to tt. However it is also well-known that the path measures ptNp_{t}^{N}, while converging to ptp_{t} with NN, have a Monte Carlo error typically exploding at least quadratically with the time tt (Del Moral and Doucet, 2003; Poyiadjis et al, 2011). Indeed the paths quickly coalesce due to the resampling steps, thus providing a poor approximation of the marginal distributions p(dxs∣y1:t)p(dx_{s}|y_{1:t}) for large values of t−st-s. In the following we refer to the collection of paths xˉ0:t1:N\bar{x}_{0:t}^{1:N} as the ancestry tree, to each xskx^{k}_{s} (for k=1,…,Nk=1,\ldots,N and s=0,…,ts=0,\ldots,t) as a node, to each xtkx^{k}_{t} more specifically as a leaf node, and to paths as branches.

Figure 1 might help to visualise the typical shape of the ancestry tree generated by a particle filter. The time at which all the branches coalesce, denoted by cTc_{T}, separates the “trunk” made of a unique branch from t=0t=0 to t=cT−1t=c_{T}-1 from the “crown” made of all the branches from t=cTt=c_{T} to t=Tt=T. Despite its negative consequence on the estimation of filtering quantities, the particle degeneracy phenomenon results in crowns of small sizes, allowing full trees to be stored at low memory cost. This can be beneficial whenever full paths of the particle filter are required, such as for the conditional sequential Monte Carlo and particle Gibbs algorithms first described in Andrieu et al (2010), studied in Chopin and Singh (2013), and used extensively in Chopin et al (2013) and Lindsten et al (2012). Another instance of sequential Monte Carlo method requiring path storage is presented in Wang et al (2014) in the context of computational biology. In the present article algorithms and results are presented in the filtering terminology, however they immediately extend to any sequential Monte Carlo method for Feynman-Kac models (Del Moral, 2004).

In Section 2 we present an efficient algorithm to store ancestry trees recursively during the run of a particle filter. In Section 3 we present new theoretical results bounding the size of ancestry trees, in order to bound the expected memory requirements of the storage algorithm. Finally the theoretical results and the algorithmic performance are tested numerically in Section 4.

Algorithms

This section introduces a memory-efficient data structure and associated algorithms for storing only those paths with support at time tt. The algorithms are designed for parallel execution, in keeping with the general parallelisability of other components of sequential Monte Carlo samplers (Lee et al, 2010; Murray, 2013).

Up to time tt, the particle filter produces particles x1:t1:Nx^{1:N}_{1:t} and ancestors a1:t1:Na^{1:N}_{1:t}. From a1:t1:Na^{1:N}_{1:t}, offspring counts o1:t1:No^{1:N}_{1:t} are readily obtained (Murray et al, 2013), where otio^{i}_{t} represents the number of children at generation tt of particle xt−1ix^{i}_{t-1}. Let x∗1:Mx^{1:M}_{*} represent MM slots in memory for storing particles. At any time, some of these slots are empty, while others store the nodes of the tree. Let a∗1:Ma^{1:M}_{*} be an ancestry vector, where a∗i=0a^{i}_{*}=0 if x∗ix^{i}_{*} is empty or a root node, and otherwise a∗i=ja^{i}_{*}=j to indicate that the particle in x∗jx^{j}_{*} is the parent of the particle in x∗ix^{i}_{*}. Let o∗1:Mo^{1:M}_{*} be the offspring vector corresponding to a∗1:Ma^{1:M}_{*}, where o∗i=no^{i}_{*}=n indicates that x∗ix^{i}_{*} has nn children. Finally, let l∗1:Nl^{1:N}_{*} give the numbers of the NN slots in x∗1:Mx^{1:M}_{*} that store the particles of the youngest generation; these are the leaf nodes of the tree.

Basic operations on the tree are its initialisation, the insertion of a new generation of particles, and the pruning of older particles to remove those without a surviving descendent in the youngest generation. These operations are described in Algorithm 2. The descriptions there rely on primitive operations defined in Algorithm 3. The efficient implementation of such primitives is well understood in both serial and parallel contexts, so that they make useful building blocks for the higher-level algorithms.

To begin, the first of the MM empty slots of the tree are initialised with the first generation of NN particles as in the init procedure of Algorithm 2. We assume, for now, that MM is sufficiently large to accommodate all subsequent operations on the tree, but see remarks in Section 2.2 below.

Each new generation is inserted as in the insert procedure of Algorithm 2. The procedure searches for nodes with no offspring in the current generation, and replaces them with the new leaf nodes. The vector z∗z_{*} is introduced, where z∗iz_{*}^{i} is equal to the number of nodes between 11 and ii with no offspring. Nodes to replace are then located by searching for the increments in z∗z_{*}. The new generation is inserted at these locations.

Finally, the tree is pruned before the insertion of each new generation tt, using the prune procedure of Algorithm 2. This requires the offspring vector, oto_{t}, of the new generation. The algorithm determines which of the current leaf nodes have no offspring in the new generation, decrements the offspring counts of their parent nodes, and proceeds recursively up the tree for cases where the parent has no remaining offspring either. Each non-leaf node ii is considered pruned if o∗i=0o^{i}_{*}=0, and may be overwritten by future calls to insert.

2 Remarks and improvements

The insert procedure of Algorithm 2 assumes that there are at least NN free slots in which to place the latest nodes. If this is not true, the buffer can be enlarged by allocating a larger block of memory, copying the contents of the ancestry tree across, and filling the new regions of the o∗o_{*} and a∗a_{*} vectors with zeros. Various heuristics can be used to set the new size MM, aiming to reduce fragmentation and the chance of future increases. Because memory reallocations involve an expensive copy, it is worth increasing MM more than strictly necessary to postpone additional reallocations. For instance, implementations of the C++ Standard Template Library typically double the storage capacity of a vector that is extended by just one element, anticipating further extensions. A more conservative strategy is to start with a value of MM equal to a small multiple of NN, and enlarge by NN slots whenever necessary. Ultimately, we have not found that the particular enlargement strategy affects execution time a great deal, particularly since, as in the proceeding theoretical results, the size of the ancestry tree crown is independent of TT, so that the need for reallocations diminishes as tt increases.

According to the results of Section 3, the expectation of the size of the tree grows linearly with TT, but this is only due to the trunk. The size of the crown is independent of TT. It may be possible to improve the algorithms by identifying the nodes along the trunk and storing them separately, as these nodes will never be overwritten by subsequent insertions. Under this modified scheme a separate, single growing trunk needs to be stored but not searched, while the nodes of the crown need to be stored and searched at every time step. The number of nodes in the crown is of constant expectation according to Theorem 3.1 of Section 3. Hence this modification induces a scheme of constant expected computational cost in TT, which could be relevant in applications where the time horizon is very long, although there will be overhead in identifying the trunk. See Fig. 3(b) in Section 4 for a report on the computational cost of the proposed method. Memory reallocation is also reduced by storing the trunk separately.

We establish in Section 3 that the size of the tree is expected to be bounded by T+Δ2Nlog⁡NT+\Delta_{2}N\log N for some constant Δ2\Delta_{2}. The size of the data structure, MM, must be at least as large as this. We assume that, with a sensible enlargement strategy, it is no more than a constant factor larger than this, so that its expected memory complexity is O(T+Δ2Nlog⁡N)\mathcal{O}(T+\Delta_{2}N\log N).

The computational complexity of init is linear in the size of the data structure, O(T+Δ2Nlog⁡N)\mathcal{O}(T+\Delta_{2}N\log N). A serial implementation of insert permits a linear prefix sum and search, so that insert is also O(T+Δ2Nlog⁡N)\mathcal{O}(T+\Delta_{2}N\log N). In parallel, a linear prefix sum is still achieved (Sengupta et al, 2008), but the search becomes NN binary searches, logarithmic to the size of the data structure; overall O(Nlog⁡(T+Δ2Nlog⁡N))\mathcal{O}(N\log(T+\Delta_{2}N\log N)).

For prune, consider the best case, where all particles of the previous generation have an offspring in the new generation. The complexity is then O(N)\mathcal{O}(N): the algorithm operates on each of the NN new nodes, but does not traverse the tree further. Now consider the worst case, where only one particle of generation tt has offspring in the new generation t+1t+1. In this case all but tt nodes of the existing tree are pruned, so that the complexity is O(T+Δ2Nlog⁡N−t)\mathcal{O}(T+\Delta_{2}N\log N-t) – linear in the size of the data structure, and parellelisable.

Finally, the transform-prefix-sum across the full vector o∗o_{*} in the insert is redundant. The sum can be truncated once it has reached NN, as a sufficient number of free slots have then been found. This is simple to achieve in the serial case, but it is not obvious how to achieve it in the parallel case. Heuristic include considering only a subset of o∗o_{*} at a time and iterating until a sufficient number of free slots are found, and starting the cumulative sum after the last slot that was filled in the previous call to insert. In practice, however, we have observed only negligible variation in execution times when applying such heuristics, and so have chosen to present the simplest version here.

Size of the ancestry tree

From a theoretical point of view, similar random trees have been studied in population genetics Del Moral et al (2009); Möhle (2004) in a setting that corresponds to a state-space model that assigns equal weights to all paths; these results do not apply directly here. In order to bound the expected number of nodes in an ancestry tree, we first study the distance dT=T−cTd_{T}=T-c_{T} between the final time TT and the full coalescence time cTc_{T} when all the paths merge. Theorem 3.1 proposes a bound on the expectation of dTd_{T}, which is independent of TT and explicit in NN.

There exists ϵ∈\epsilon\in such that for all y∈Yy\in\mathcal{Y} and for all x∈Xx\in\mathcal{X}

Under Assumption 1 the distance to the most recent common ancestor dTd_{T} satisfies

for some Δ1>0\Delta_{1}>0, which does not depend NN nor TT.

The expected number of nodes in the tree can be bounded explicitly in NN and TT, as in Theorem 3.2.

We suppose here that N≥3N\geq 3. Under Assumption 1 the number of nodes, denoted by nTn_{T} at time TT, satisfies

for some Δ2>0\Delta_{2}>0 that does not depend on NN nor TT.

These results quantify the practical difference between storing all the generated particles (for a deterministic cost of T×NT\times N memory units) and storing only the surviving particles (for a random cost expected to be bounded by T+Δ2Nlog⁡NT+\Delta_{2}N\log N).

Assumption 1 is very strong outside compact spaces, and for instance does not even cover the linear-Gaussian case, although the experiments of Section 4 indicate that similar results might hold for non-linear and non-Gaussian cases. The numerical experiments show that the bound is accurate as a function of NN, so that even if some inequalities used in the proofs appear quite crude, the overall result is precise. However the results do not capture the shape of the tree as a function of ϵ\epsilon, which is why we write the constants Δ1\Delta_{1} and Δ2\Delta_{2} without making their dependency on ϵ\epsilon explicit. Consider for example Theorem 3.1, where Δ1\Delta_{1} can be defined by Δ1=1+8/ϵ\Delta_{1}=1+8/\epsilon, as will be proven in Section 3.3. If the bound was sharp as a function of ϵ\epsilon, it would mean that the time to full coalescence increases to infinity when ϵ\epsilon goes to zero. However path degeneracy is expected be more acute for smaller ϵ\epsilon, since more variability in the particle weights is then allowed. The dependency on ϵ\epsilon in Δ1\Delta_{1} is thus not realistic. We believe the bounds could in fact be independent of ϵ\epsilon, by considering ϵ=1\epsilon=1 as the case corresponding to the largest expectations of dTd_{T} and nTn_{T}; a claim not proven here.

Moreover, the proposed proof relies on the multinomial resampling scheme, while most practitioners favour more sophisticated schemes (Carpenter et al, 1999; Liu and Chen, 1998; Kitagawa, 1998; Doucet and Johansen, 2011). Figure 3(a) of Section 4 indicates that similar results hold for these other resampling schemes. There are some obvious counter-examples, for instance when the measurement density is constant, leading to equal weights at each step (equivalently ϵ=1\epsilon=1). Then the results above hold for multinomial resampling but systematic resampling would completely obviate the path degeneracy phenomenon. Describing features of ancestry trees corresponding to general resampling schemes would constitute an interesting avenue of research.

The rest of the section is devoted to proving Theorem 3.1 and Theorem 3.2.

2 From non-uniform weights to uniform weights

We first relate the ancestry process associated with particle filters using multinomial resampling, with the ancestry process associated with the neutral case, where all the weights would be equal to N−1N^{-1} at every time step. To do so we introduce various intermediate processes, starting with the exact multinomial resampling process denoted by (At)t≥0(A_{t})_{t\geq 0}, then an approximation represented by (At′)t≥0(A^{\prime}_{t})_{t\geq 0} which provides an almost sure upper bound and eventually a process (Zk)k≥0(Z_{k})_{k\geq 0} counting the number of nodes at generation T−kT-k in the neutral case, for a fixed time horizon TT.

For each time tt, define At: j∈{1,…,N}↦atj∈{1,…,N}A_{t}:\,j\in\{1,\ldots,N\}\mapsto a_{t}^{j}\in\{1,\ldots,N\} and then At′:{1,…,N}→{1,…,N}A_{t}^{\prime}:\{1,\ldots,N\}\rightarrow\{1,\ldots,N\} as follows. For all jj in Ct={k∈{1,…,N}:Vtk≤ϵ}C_{t}=\{k\in\{1,\ldots,N\}:V_{t}^{k}\leq\epsilon\}, set At′(j)=atjA_{t}^{\prime}(j)=a_{t}^{j}. Order the pp remaining indices of the set {j∈{1,…,N}:Vjt>ϵ}\{j\in\{1,\ldots,N\}:V_{j}^{t}>\epsilon\} into {j1<⋯<jp}\{j_{1}<\dots<j_{p}\}, set At′(j1)=inf⁡({1,…,N}\At′(Ct))A^{\prime}_{t}(j_{1})=\inf(\{1,\ldots,N\}\backslash A^{\prime}_{t}(C_{t})) and then recursively

Such a function At′A_{t}^{\prime} almost surely maps to more unique values than AtA_{t} by construction. It can be seen as a mixture of two steps, as described for AtA_{t} above, but this time neither step relies on the values of the weights.

We write ∣u∣\lvert u\rvert for the cardinal of the image of a function u:{1,…,N}→{1,…,N}u:\{1,\ldots,N\}\rightarrow\{1,\ldots,N\}. In terms of the functions (Ak)k≤T−1(A_{k})_{k\leq T-1}, the full coalescence time cTc_{T} can be defined as

with the convention cT=0c_{T}=0 in the event ∣Ak∘Ak+1∘⋯∘AT−1∣>1\mid A_{k}\circ A_{k+1}\circ\dots\circ A_{T-1}\mid>1 for each 0≤k≤T−10\leq k\leq T-1, which almost surely satisfies cT≥cT′c_{T}\geq c^{\prime}_{T} with

Indeed since At′A^{\prime}_{t} maps to more unique values than AtA_{t} at each time tt, the quantity ∣Ak′∘⋯∘AT−1′∣\mid A^{\prime}_{k}\circ\dots\circ A^{\prime}_{T-1}\mid, counting the unique ancestors from generation kk of the particles at time TT when using the resampling scheme A′A^{\prime}, is almost surely larger than ∣Ak∘⋯∘AT−1∣\mid A_{k}\circ\dots\circ A_{T-1}\mid for any kk, and hence it takes longer to reach the full coalescence time when using A′A^{\prime} compared to AA.

Following Del Moral et al (2009), Section 4 and Möhle (2004), the sequence (Kk)k≥0=(∣AT−k′∘⋯∘AT−1′∣)k≥0(K_{k})_{k\geq 0}=(\mid A^{\prime}_{T-k}\circ\dots\circ A^{\prime}_{T-1}\mid)_{k\geq 0} is a Markov chain in the filtration (Fk)k≥1(\mathcal{F}_{k})_{k\geq 1} with

with the convention K0=NK_{0}=N. For all k≥0k\geq 0, q∈{1,…,N}q\in\{1,\ldots,N\} and p<qp<q its transition law verifies

where {qp}\genfrac{\{}{\}}{0.0pt}{}{q}{p} is the Stirling number of the second kind giving the number of ways of partitioning the set {1,…,q}\{1,\ldots,q\} into pp non empty blocks and where (N)p=N!/(N−p)!(N)_{p}=N!/(N-p)!. Note that Eq. (2) is a special case of Eq. (1).

following the same reasoning as for the transition probabilities of (Kk)k≥0(K_{k})_{k\geq 0}. The initial distribution of Z0Z_{0} is not used in the following hence we do not need to specify it. The link between (Zk)k≥0\left(Z_{k}\right)_{k\geq 0} and (Kk)k≥0\left(K_{k}\right)_{k\geq 0} is explicitly given by

Note that the process (Zk)k≥0(Z_{k})_{k\geq 0} is not used in the proof of Theorem 3.1, where we start from (Kk)k≥0(K_{k})_{k\geq 0} again, but is pivotal for the proof of Theorem 3.2.

3 Distance to the most recent common ancestor

where pN,qp_{N,q} is defined in Eq. (2). In addition we couple (Lk)k≥0(L_{k})_{k\geq 0} and (Kk)k≥0(K_{k})_{k\geq 0} by assuming

[Lk=Kk]<spanclass="katex−display"><spanclass="katex"><spanclass="katex−mathml"><mathxmlns="http://www.w3.org/1998/Math/MathML"display="block"><semantics><mrow><mo>⇒</mo></mrow><annotationencoding="application/x−tex">⇒</annotation></semantics></math></span><spanclass="katex−html"aria−hidden="true"><spanclass="base"><spanclass="strut"style="height:0.3669em;"></span><spanclass="mrel">⇒</span></span></span></span></span>[Lk+1<Lk⇔Kk+1<Kk]\left[L_{k}=K_{k}\right]<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo>⇒</mo></mrow><annotation encoding="application/x-tex">\Rightarrow</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.3669em;"></span><span class="mrel">⇒</span></span></span></span></span>\left[L_{k+1}<L_{k}\Leftrightarrow K_{k+1}<K_{k}\right] (if the two chains are at the same point, then if one of them decreases, the other one decreases too)

[Lk≠Kk]⇒[L_{k}\neq K_{k}]\RightarrowKk+1K_{k+1}and Lk+1L_{k+1} are independent, conditionally upon LkL_{k}, KkK_{k}.

By construction Lk≥KkL_{k}\geq K_{k} for all k≥0k\geq 0 almost surely. Hence cT′≥T−DTc^{\prime}_{T}\geq T-\mathcal{D}_{T} with DT=inf⁡{k≥1:Lk=1}\mathcal{D}_{T}=\inf\{k\geq 1:L_{k}=1\} and thus dT=T−cT≤T−cT′≤DTd_{T}=T-c_{T}\leq T-c^{\prime}_{T}\leq\mathcal{D}_{T} almost surely.

We have, for all NN, (8N)−1≤1−exp⁡{−1/2N}(8N)^{-1}\leq 1-\exp\{-1/2N\} and for all x≥1x\geq 1 and ε∈(0,1)\varepsilon\in(0,1), (1−ε/x)x≤exp⁡(−ε)(1-\varepsilon/x)^{x}\leq\exp(-\varepsilon); combining these inequalities we obtain

where α=exp⁡(−ϵ/8)\alpha=\exp(-\epsilon/8). We can now bound this series by expanding αq/N=exp⁡{(q/N)log⁡α}\alpha^{q/N}=\exp\{(q/N)\log\alpha\} into an alternating series and by bounding the alternating series always by one of its partial sums:

which concludes the proof of Theorem 3.1.

4 Number of nodes in the ancestry tree

We now proceed to the proof of Theorem 3.2. Denote by mTm_{T} the number of nodes in the crown. The bound on dTd_{T} from Theorem 3.1 gives a first crude bound

which is obtained by bounding the size of every generation in the crown by NN. However we can obtain a better bound, in Nlog⁡NN\log N, by the following arguments.

By expanding (1−(1−ϵ/N)q)(1-(1-\epsilon/N)^{q}) into its alternating series and bounding the series by its third partial sum, we obtain

Now for x∈[1,N]x\in[1,N] define the function gN,ϵg_{N,\epsilon} by:

Noting that gN,ϵg_{N,\epsilon} is concave and using Jensen’s inequality, we obtain

Then there exists C>0C>0 independent of NN such that

The proof of Lemma 1, based on elementary real analysis, is given in Appendix A. Using Lemma 1 and Eq. (8) we obtain Theorem 3.2 with Δ2=C+Δ1\Delta_{2}=C+\Delta_{1}.

Numerical experiments

This section provides numerical experiments to illustrate the results of Section 3 and the efficiency of the algorithms presented in Section 2. The results summarise K=500K=500 independent runs, using N=128N=128 particles and T≤1000T\leq 1000 time steps. For each run, a new synthetic dataset is generated and a different random seed is used. The default resampling scheme is the multinomial scheme, applied at every time step. The algorithms of Section 2 have been implemented in LibBi (Murray, 2013, www.libbi.org), which is used for the numerical results here.

We use the Phytoplankton-Zooplankton (PZ) model described in Jones et al (2010) and Murray et al (2012). Concentrations of phytoplankton (Pt)(P_{t}) and zooplankton (Zt)(Z_{t}), along with the stochastic growth rate of phytoplankton (αt)(\alpha_{t}), constitute the hidden state. The state follows the continuous-time dynamics dP/dt=αtP−cPZdP/dt=\alpha_{t}P-cPZ and dZ/dt=ecPZ−mlZ−mqZ2dZ/dt=ecPZ-m_{l}Z-m_{q}Z^{2}, with αt∼N(μ,σ2)\alpha_{t}\sim\mathcal{N}(\mu,\sigma^{2}) drawn at every integer time tt. The initial conditions are log⁡P0∼N(log⁡(2),0.2)\log P_{0}\sim\mathcal{N}(\log(2),0.2), log⁡Z0∼N(log⁡(2),0.1)\log Z_{0}\sim\mathcal{N}(\log(2),0.1). The observations (Yt)(Y_{t}) measure (Pt)(P_{t}) with additive log-normal noise, that is log⁡Yt∼N(log⁡Pt,σy)\log Y_{t}\sim\mathcal{N}(\log P_{t},\sigma_{y}). The parameters are set to μ=0.4\mu=0.4, σ=0.2\sigma=0.2, c=0.25c=0.25, e=0.3e=0.3, ml=mq=0.1m_{l}=m_{q}=0.1 and σy=0.2\sigma_{y}=0.2.

To illustrate the efficiency of the procedures presented in Section 2, Fig. 3(b) shows the combined time taken to execute the pruning and insertion algorithms at each time step, for various TT and NN. The results suggest that the computational cost is not greatly influenced by TT, and close to linear with respect to NN: evidence of a practical implementation with comparable complexity to the particle filter itself.

Conclusion

We have presented a bound on the expected number of nodes in the ancestry tree produced by particle filters. The numerical experiments of Section 4 indicate that the result is accurate, even outside the scope of the assumptions made in the theoretical study, and that the proposed algorithm to store the tree is computationally efficient.

Appendix A Proof of Lemma 1

however this contraction coefficient depends on NN and a direct use of it yields a bound on ∑k≥0(uk−1)\sum_{k\geq 0}(u_{k}-1) that is not in Nlog⁡NN\log N.

Note also that even though uku_{k} goes to 11, we can focus on the partial sum ∑k=0σ2(uk−1)\sum_{k=0}^{\sigma_{2}}(u_{k}-1) where σ2=inf⁡{k:uk≤2}\sigma_{2}=\inf\{k:u_{k}\leq 2\}, because ∑k=σ2∞(uk−1)\sum_{k=\sigma_{2}}^{\infty}(u_{k}-1) is essentially bounded by NN. Indeed note that for 1≤u≤21\leq u\leq 2 we have (ϵ3/6N2)u(u−1)(u−2)≤0(\epsilon^{3}/6N^{2})u(u-1)(u-2)\leq 0 so that

hence ∑k=σ2∞(uk−1)≤(2N/ϵ2)\sum_{k=\sigma_{2}}^{\infty}(u_{k}-1)\leq(2N/\epsilon^{2}). Therefore we can focus on bounding ∑k=0σ2(uk−1)\sum_{k=0}^{\sigma_{2}}(u_{k}-1) by Nlog⁡NN\log N. Let us split this sum into partial sums, where the first partial sum is over indices kk such that N/2≤uk≤NN/2\leq u_{k}\leq N, the second is over indices kk such that N/4≤uk≤N/2N/4\leq u_{k}\leq N/2, etc. More formally, we introduce (kj)j=0J(k_{j})_{j=0}^{J} such that k0=0k_{0}=0, k1=inf⁡{k:uk≤N/2}k_{1}=\inf\{k:u_{k}\leq N/2\}, …, kj=inf⁡{k:uk≤N/2j}k_{j}=\inf\{k:u_{k}\leq N/2^{j}\}, up to kJ=inf⁡{k:uk≤N/2J}k_{J}=\inf\{k:u_{k}\leq N/2^{J}\} where JJ is such that N/2J≤2N/2^{J}\leq 2, or equivalently log⁡N/log⁡2−1≤J\log N/\log 2-1\leq J. For instance we take J=⌊log⁡N/log⁡2⌋J=\lfloor\log N/\log 2\rfloor. Thus we have split ∑k=0σ2(uk−1)\sum_{k=0}^{\sigma_{2}}(u_{k}-1) into JJ partial sums of the form ∑k=kjkj+1−1(uk−1)\sum_{k=k_{j}}^{k_{j+1}-1}(u_{k}-1) and we are now going to bound each of these partial sum by the same quantity C(ϵ)NC(\epsilon)N for some C(ϵ)C(\epsilon) that depends only on ϵ\epsilon.

To do so, we consider the time needed by (uk)k≥0(u_{k})_{k\geq 0} to decrease from a value N/mjN/m_{j} to a value N/mj+1N/m_{j+1}, with mj+1>mjm_{j+1}>m_{j}; we will later take mj=2jm_{j}=2^{j} and mj+1=2j+1m_{j+1}=2^{j+1}. Note that for any mm we have

and note that for any N≥6N\geq 6 and m≤N/2m\leq N/2 we have

which is clear upon noticing that β(N,m,ϵ)\beta(N,m,\epsilon) as a function of mm on [1,N/2][1,N/2] is concave and thus reaches its minimum in 11 or N/2N/2 (and this minimum is greater than ϵ2/4\epsilon^{2}/4, provided N≥6N\geq 6). For any x≥N/mj+1x\geq N/m_{j+1} we can check that

by noticing that gN,ϵg_{N,\epsilon} is concave and that gN,ϵ(x)≤xg_{N,\epsilon}(x)\leq x for x∈[0,N]x\in[0,N]. Hence for k≥0k\geq 0 such that uk−1≥N/mj+1u_{k-1}\geq N/m_{j+1}, we have

Now suppose that for some kj≥0k_{j}\geq 0 we have ukj≤N/mju_{k_{j}}\leq N/m_{j}. Then let us find KK such that ukj+K≤N/mj+1u_{k_{j}+K}\leq N/m_{j+1}. It is sufficient to find KK such that

guarantees the inequality ukj+K≤N/mj+1u_{k_{j}+K}\leq N/m_{j+1}. In other words (uk)k≥0(u_{k})_{k\geq 0} needs less than KK steps to decrease from N/mjN/m_{j} to N/mj+1N/m_{j+1}. Summing the terms between kjk_{j} and kj+Kk_{j}+K, we obtain

Taking mj=2jm_{j}=2^{j} and mj+1=2j+1m_{j+1}=2^{j+1}, we have kj+1≤kj+Kk_{j+1}\leq k_{j}+K and thus obtain

with C(ϵ)C(\epsilon) independent of NN. We have thus bounded the full sum by

for some D(ϵ)D(\epsilon) independent of NN.

References