Sequential Kernel Herding: Frank-Wolfe Optimization for Particle Filtering
Simon Lacoste-Julien, Fredrik Lindsten, Francis Bach
Introduction
In this paper, we explore a way to combine ideas from optimization with sampling to get better approximations in probabilistic models. We consider state-space models (SSMs, also referred to as general state-space hidden Markov models), as they constitute an important class of models in engineering, econometrics and other areas involving time series and dynamical systems. A discrete-time, nonlinear SSM can be written as
where denotes the latent state variable and the observation at time . Exact state inference in SSMs is possible, essentially, only when the model is linear and Gaussian or when the state-space is a finite set. For solving the inference problem beyond these restricted model classes, sequential Monte Carlo methods, i.e. particle filters (PFs), have emerged as a key tool; see e.g., Doucet and Johansen (2011); Cappé et al. (2005); Doucet et al. (2000). However, since these methods are based on Monte Carlo integration they are inherently affected by sampling variance, which can degrade the performance of the estimators.
Particular challenges arise in the case when the observation likelihood is computationally expensive to evaluate. For instance, this is common in robotics applications where the observation model relates the sensory input of the robot, which can comprise vision-based systems, laser rangefinders, synthetic aperture radars, etc. For such systems, simply evaluating the observation function for a fixed value of can therefore involve computationally expensive operations, such as image processing, point-set registration, and related tasks. This poses difficulties for particle-filtering-based solutions for two reasons: (1) the computational bottleneck arising from the likelihood evaluation implies that we cannot simply increase the number of particles to improve the accuracy, and (2) this type of “complicated” observation models will typically not allow for adaptation of the proposal distribution used within the filter, in the spirit of Pitt and Shephard (1999), leaving us with the standard—but inefficient—bootstrap proposal as the only viable option. On the contrary, for these systems, the dynamical model is often comparatively simple, e.g. being a linear and Gaussian “nearly constant acceleration” model (Ristic et al., 2004).
The method developed in this paper is geared toward this class of filtering problems. The basic idea is that, in scenarios when the likelihood evaluation is the computational bottleneck, we can afford to spend additional computations to improve upon the sampling of the particles. By doing so, we can avoid excessive variance arising from simple Monte Carlo sampling from the bootstrap proposal.
We build on the optimization view from Bach et al. (2012) of kernel herding (Chen et al., 2010) to approximate the integrals appearing in the Bayesian filtering recursions. We make use of the Frank-Wolfe (FW) quadrature to approximate, in particular, mixtures of Gaussians which often arise in a particle filtering context as the mixture over past particles in the distribution over the next state. We use this approach within a filtering framework and prove theoretical convergence results for the resulting method, denoted as sequential kernel herding (SKH), giving one of the first explicit better convergence rates than for a particle filter. Our preliminary experiments show that SKH can give better accuracy than a standard particle filter or a quasi-Monte Carlo particle filter.
Adaptive quadrature rules with Frank-Wolfe optimization
and so by bounding , we can bound the error of approximating the expectation for all , with as a proportionality constant. is thus a central quantity for developing good quadrature rules given by (2). In the context of RKHSs, can be called the maximum mean discrepancy (Gretton et al., 2012) between the distributions and , and acts a pseudo-metric on the space of distributions on . If is a characteristic kernel (such as the standard RBF kernel), then is in fact a metric, i.e. . We refer the reader to Sriperumbudur et al. (2010) for the regularity conditions needed for the existence of these objects and for more details.
2 Frank-Wolfe optimization for adaptive quadrature
Algorithm 1 presents the Frank-Wolfe optimization algorithm to solve in the context of getting quadrature rules (we also introduce the shorthand notation ). We note that to evaluate the quality of this adaptive quadrature rule, we need to be able to evaluate efficiently. This is true only for specific pairs of kernels and distributions, but fortunately this is the case when is a mixture of Gaussians and is a Gaussian kernel. This insight is central to this paper; we explore this case more specifically in Section 2.3. To find the next quadrature point, we also need to (approximately) optimize over (step 3 of Algorithm 1, called the FW vertex search). In general, this will yield a non-convex optimization problem, and thus cannot be solved with guarantees, even with gradient descent. In our current implementation, we approach step 3 by doing an exhaustive search over random samples from precomputed when FW-Quad is called. We thus follow the idea from the kernel herding paper (Chen et al., 2010) to choose the best “super-samples” out of a large set of samples . Thanks to the fact that convergence guarantees for Frank-Wolfe optimization can still be given when using an approximate FW vertex search, we show in Appendix B of the supplementary material that this procedure either adds a term or a term to the worst-case error.
In our description of Algorithm 1, a preset number of particles (iterations) was used. Alternatively, we could use a variable number of iterations with the terminating criterion test which can be explicitly computed during the algorithm and provides the error bound on the returned quadrature rule. Option (2) on line 5 chooses the step-size by analytic line-search (hereafter referred as the FW-LS version) while option (1) chooses the kernel herding step-size (herafter referred as the FW version) which always yields uniform weights: for all . A third alternative is to re-optimize over the convex hull of the previously visited vertices; this is called the fully corrective version (Jaggi, 2013) of the Frank-Wolfe algorithm (hereafter referred as FCFW). In this case: , where is the -dimensional probability simplex, is the kernel matrix on the vertices: and for . This is a convex quadratic problem over the simplex. A slightly modified version of the FCFW is called the min-norm point algorithm and can be more efficiently optimized using specific purpose active-set algorithms — see Bach (2013, §9.2) for more details. We refer the reader to Bach et al. (2012) for more details on the rate of convergence of Frank-Wolfe quadrature assuming that the FW vertex is found with guarantees. We summarize them as follows: if is infinite dimensional, then FW-Quad gives the same rate for the MMD error as standard random sampling, for all FW methods. On the other hand, if a ball of non-zero radius centered at lies within , then faster rates than random sampling are possible: FW gives a rate whereas FW-LS and FCFW gives exponential convergence rates (though in practice, we often see differences not explained by the theory between these methods).
3 Example: mixture of Gaussians
Sequential kernel herding
Consider again the SSM in (1). The joint probability density function for a sequence of latent states and observations factorizes as , with denoting the prior density on the initial state. We would like to do approximate inference in this SSM. In particular, we could be interested in computing the joint filtering distribution or the joint predictive distribution . In particle filtering methods, we approximate these distributions with empirical distributions from weighted particle sets as in (2). We note that it is easy to marginalize with a simple weight summation, and so we will present the algorithm as getting an approximation for the joint distributions and defined above, with the understanding that the marginal ones are easy to obtain afterwards. In the terminology of particle filtering, is the particle at time , whereas is the particle trajectory. While principally the PF provides an approximation of the full joint distribution , it is well known that this approximation deteriorates for any marginal of for (Doucet and Johansen, 2011). Hence, the PF is typically only used to approximate marginals of for (fixed-lag smoothing) or (filtering), or for prediction.
2 Sequential kernel herding
3 Convergence theory
In this section, we give sufficient conditions to guarantee that SKH is consistent as goes to infinity. Let here denote the marginalized predictive instead of the joint. Let be the forward transformation operator on signed measures that takes the predictive distribution on and yields the un-normalized marginalized predictive distribution on in the SSM. Thus for a measure , we get . We also have that .
For the following theorem, is a function space on defined (depending on ) as all functions for which the following semi-norm is finite:In general, the integral on should be with respect to the base measure for which the conditional density is defined. All proofs are in the supplementary material.
Suppose that the function is in the tensor product function space with the following defined nuclear norm: , where the infimum is taken over all the possible expansions such that for all . Then for any finite signed Borel measure on , we have:
Suppose that for all , is in as defined in Theorem 1 and is in . Then we have:We use the convention that the empty sum is and the empty product is .
We note that as we expect the errors on to go in either direction, and thus to cancel each other over time (though in the worst case it could grow exponentially in ). If and , we basically have if ; if ; and if (a contraction). The exponential dependence in is similar as for a standard particle filter for general distributions; see Douc et al. (2014) though for conditions to get a contraction for the PF.
Experiments
We start by investigating the merits of different sampling schemes for approximating mixtures of Gaussians, since this is an intrinsic step to the SKH algorithm. In Figure 1, we give the error as well as the error on the mean function in term of the number of particles for the different sampling schemes on a randomly chosen mixture of Gaussians with components in dimensions. Additional results as well as the details of the model are given in Appendix C.1 of the supplementary material. In our experiments, the number of FW search points is . We note that even though in theory all methods should have the same rate of convergence for the (as is infinite dimensional), FCFW empirically improves significantly over the other methods. As increases, the difference between the methods tapers off for a fixed kernel bandwidth , but increasing gives better results for FW and FCFW than the other schemes.
In the remaining sections, we evaluate empirically the application of kernel herding in a filtering context using the proposed SKH algorithm.
2 Particle filtering using SKH on synthetic examples
We consider first several synthetic data sets in order to assess the improvements offered by Frank-Wolfe quadrature over standard Monte Carlo and quasi-Monte-Carlo techniques. We generate data from four different systems (further details on the experimental setup can be found in Appendix C.2):
Two linear Gaussian state-space (LGSS) models of dimensions and , respectively.
A jump Markov linear system (JMLS), consisting of 2 interacting LGSS models of dimension . The switching between the models is governed by a hidden 2-state Markov chain.
A nonlinear benchmark time-series model used by, among others, Doucet et al. (2000); Gordon et al. (1993). The model is of dimension and is given by:
with and mutually independent standard Gaussian.
These models are ordered in increasing levels of difficulty for inference. For the LGSS models, the exact filtering distributions can be computed by a Kalman filter. For the JMLS, this is also possible by running a mixture of Kalman filters, albeit at a computational cost of (where is the total number of time steps). For the nonlinear system, no closed form expressions are available for the filtering densities; instead we run a PF with particles as a reference.
We generate batches of observations for time steps from all systems, except for the JMLS where we use (to allow exact filtering). We run the proposed SKH filter, using both FW and FCFW optimization and compare against a bootstrap PF (using stratified resampling (Carpenter et al., 1999)) and a quasi-Monte-Carlo PF based on a Sobol-sequence point-set. All methods are run with varying from to particles. We deliberately use rather few particles since, as discussed above, we believe that this is the setting when the proposed method can be particularly useful.
To assess the performances of the different methods, we first compute the root-mean-squared errors (RMSE) for the filtered mean-state-estimates over the time steps, w.r.t. the reference filters. We report the median RMSEs over the 30 different data batches, along with the and quantiles, and the minimum and maximum values in Figure 2. The SKH algorithms were run for three different values of . Here, we report the results for for the LGSS models and the JMLS, and for for the nonlinear benchmark model. The results for the other values are given in Appendix C.2. The improvements are somewhat robust to the value of , but in some cases significant differences were observed. As can be seen, both SKH methods improve significantly upon both QMC and the bootstrap PF. For the two LGSS models, we also compute the MMD (reported in the rightmost column in Figure 2).
3 Vision-based UAV Localization
In this section, we apply the proposed SKH algorithm to solve a filtering problem in field robotics. We use the data and the experimental setup described by Törnqvist et al. (2009). The problem consists of estimating the full six-dimensional pose of an unmanned aerial vehicle (UAV).
Törnqvist et al. (2009) proposed a vision-based solution, essentially tracking interest points in the camera images over consecutive frames to estimate the ego-motion. This information is then fused with the inertial and barometer sensors to estimate the pose of the UAV. The system is modelled on state-space form, with a state vector comprising the position, velocity, acceleration, as well as the orientation and the angular velocity of the UAV. The state is also augmented with sensor biases, resulting in a state dimension of 22. Furthermore, the state is augmented with the three-dimensional positions of the interest points that are currently tracked by the vision system; this is a varying number but typically around ten.
To deal with the high-dimensional state-vector, Törnqvist et al. (2009) used a Rao-Blackwellized PF (see Appendix A) to solve the filtering problem, marginalizing all but 6 state components (being the pose, i.e., the position and orientation) using a combination of Kalman filters and extended Kalman filters. The remaining 6 state-variables were tracked using a bootstrap particle filter with particles; the strikingly small number of particles owing to the computational complexity of the likelihood evaluation.
For the current experiment, we obtained the code and the flight-test data from Törnqvist et al. (2009). The modularity of our approach allowed us to simply replace the Monte Carlo simulation step within their setup with FW-Quad. We ran SKH-FW with and SKH-FCFW with , as well as the bootstrap PF used in Törnqvist et al. (2009), and a QMC-PF; all methods using , 100, and 200 particles. We ran all methods 10 times on the same data; the variation in SKH coming from the random search points for the FW procedure, and in QMC for starting the Sobol sequence at different points. For comparison, we ran 10 times a reference PF with particles and averaged the results. The median position errors for 100 seconds of robot time (there are 20 SSM time steps per second of robot time) are given in Figure 3. The UAV is assumed to start at a known location at time zero, hence, all the errors are zero initially. Note that all methods accumulate errors over time. This is natural, since there is no absolute position reference available (i.e., the filter is unstable) and the objective is basically to keep the error as small as possible for as long time as possible. SKH-FW here gives the overall best results, with significant improvements over the bootstrap PF and the QMC methods for small number of particles. SKH-FW even gives similar errors for the last time step with only particles as one of the reference PFs (using particles). See Appendix C.2.1 for a discussion of the role of for FCFW.
In these experiments, we focused on investigating how optimization could improve the error per particle, as the gain in runtime depends on the exact implementation as well as the likelihood evaluation cost. We note that the FW-Quad algorithm scales as for samples and search points when using FW, by updating the objective on the search points in an online fashion (we also empirically observed this linear scaling in ). On the other hand, FCFW scales as as the weights on the particles possibly change at each iteration, preventing the same online trick. SKH scales linearly with the number of time steps (as a standard PF). For the UAV application, the original Matlab code from Törnqvist et al. (2009) spent an average of 0.2 s per time step for particles (linear in the number of particles as the likelihood evaluation is the bottleneck) on a XEON E5-2620 2.10 GHz PC. The overhead of using our Matlab implementation of FW-Quad with is about 0.15 s per time step for FW and 0.3 s for FCFW; and 0.3 s for FW and 1.0 s for FCFW for (we used search points in this experiment). In practice, this means that SKH-FW can be run here with 50 particles in the same time as the standard PF is run with about 90 particles. But as Figure 3 shows, the error for SKH-FW with 50 particles is still much lower than the PF with 200 particles.
Conclusion
We have developed a method for Bayesian filtering problems using a combination of optimization and particle filtering. The method has been demonstrated to provide improved performance over both random sampling and quasi-Monte Carlo methods. The proposed method is modular and it can be used with different types of particle filtering techniques, such as the Rao-Blackwellized particle filter. Further investigating this possibility for other classes of particle filters is a topic for future work. Future work also includes a deeper analysis of the convergence theory for the method in order to develop practical guidelines for the choice of the kernel bandwidth.
We thank Eric Moulines for useful discussions. This work was partially supported by the MSR-Inria Joint Centre, a grant by the European Research Council (SIERRA project 239993) and by the Swedish Research Council (project Learning of complex dynamical systems number 637-2014-466).
References
Appendix A Extension for Rao-Blackwellization
A common strategy for improving the efficiency of the PF is to make use of Rao-Blackwellization—this idea can be used also with SKH. Rao-Blackwellization, here, refers to analytically marginalizing some conditionally tractable component of the state vector and thereby reducing the dimensionality of the space on which the PF operates. Assume that the state of the system is comprised of two components and , where the filtering density for is tractable conditionally on the history of . The typical case is that of a conditionally linear Gaussian system, in which case the aforementioned conditional filtering density is Gaussian and computable using a Kalman filter (conditionally on ). The Rao-Blackwellized PF (RBPF) exploits this property by factorizing:
Appendix B Rates for SKH when using random search points
In this section, we show that we can get guarantees on the error of the FW-Quad procedure when approximately finding the FW vertex in step 3 of Algorithm 1 using exhaustive search through random samples from . This means that despite not solving step 3 exactly, the SKH procedure with random search points (under assumptions of Theorem 2) is still consistent as long as grows to infinity.
The main idea is that the rates of convergence for the Frank-Wolfe optimization procedure still holds when the linear subproblem (step 3) is solved within accuracy of . More specifically, if we guarantee that the FW vertex that we use satisfy during the algorithm, then the standard rate of convergence for FW carries through but within of the optimal objective (i.e. up to ). A simple modification of the argument by Jaggi (2013) (who used a shrinking during the FW algorithm) can show this for the step-size of ; we give the proofs for the step-size of as well as the potential faster rate for the MMD objective in Appendix G.
Let be the set of search points, and be the empirical distribution for the samples from . Let which can be made small by increasing . Consider the iteration in FW-Quad where we do exhaustive search on in step 3. We thus have:
where (). We can thus interpret step 3 as approximately solving (within ) the linear subproblem for the Frank-Wolfe optimization of over the marginal polytope of . We thus get a rate of convergence to within of . Finally, we have
Appendix C Additional details on experiments
The parameters for the mixture of Gaussians were randomly sampled as follows:
The means ’s are uniformly sampled on .
where is uniformly sampled on .
are obtained by normalizing independent uniform random variables.
Figure 4 present additional results for the mixture of Gaussians experiments. From our experiments, we make the following observations:
FCFW always performs best (this was observed similarly in Bach et al. (2012) but for other pairs of distribution / kernel).
As increases, the difference between the methods tapers off for a fixed , but increasing gives better results for FW and FCFW than the others (see for example the last column of Figure 4).
The FW-LS results are identical to FW, and so we have excluded them from the plots for clarity.
The improvement of QMC over MC decreases as the number of mixture components increase. FW and FCFW are not affected by as much.
To generate quasi-random samples from the mixture of Gaussians, we generate a -dimensional Sobol sequence using the Matlab qrandstream function. The last dimension is (naively) used to sample the mixture component by using the inverse transformation method for a discrete random variable. The first components are then used to sample from the corresponding multivariate Gaussian by transforming independent standard normals. We note that Gerber and Chopin (2014) argued on the importance of sorting the discrete mixture components according to their location before choosing them with the standard inverse transformation method (in our naive implementation, the order is arbitrary and arising from how the mixture of Gaussians was stored). They propose a method for this that they called Hilbert sort, for which they could prove nice low-discrepancy properties. This approach might reduce the sensitivity to of QMC. The worse results of QMC for the UAV experiment in Figure 3 might be explained by our naive implementation.
C.2 Synthetic data examples and additional results
In this section we provide additional details and results for the synthetic data examples. The LGSS models and the modes of the JMLS are generated randomly using the function drss from the Matlab Control Systems Toolbox. The four models that were considered are given by:
with being an observable pair. The system has poles in and .
with being an observable pair. The system has poles in , , , , , , , , , , and .
with , and the two system modes corresponding to observable systems with poles in , , and , , respectively.
Additional results, for the different values of are reported in Figures 5–8.
SKH-FW did not seem to suffer from this problem. This might partly explain why we were able to use the much bigger for the UAV experiment with good results (Figure 3) whereas we used for SKH-FCFW.
Appendix D Proof sketch for Theorem 1
Proof sketch. We assume that the function is in the tensor product , with defined as in the statement of the theorem. We consider the nuclear norm \citepsupjameson1987summing:
over all possible decompositions of such that, for all
In the following, let be such a decomposition for . We have
Now we have that , so we consider for some :
This inequality was valid for any expansion for , and thus we can take the infimum of the upper bound over all possible expansions to get:
Appendix E Special case for the Gaussian kernel
In this section, we explore what form takes for the Gaussian kernel. We then show that is finite for a simple one-dimensional linear Gaussian SSM as long as is small enough (and thus is big enough, as the size of increases when decreases for the Gaussian kernel).
For the Gaussian kernel , its Fourier transform is
By applying Cauchy-Schwartz on on the RHS, this leads to
This allows for quite peaky distributions for the dynamics, as Diracs are authorized (with constant Fourier transform).
To compute an upper bound on , we simply need to find a decomposition of as a sum of terms and bound the appropriate norms of and .
We do this for a special case in the following section.
with, using :
We thus now need to compute the norms of and , by first computing the Fourier transform. We use the representation:
integrating over a contour around the origin, which leads to:
using , with , and -\frac{1+w}{4w}+\frac{(1+w)^{2}}{8w}=\frac{1+w}{4w}\big{(}-1+\frac{1+w}{2}\big{)}=-\frac{1-w^{2}}{8w}.
We have . Thus, by continuity if if small enough, . Note that when we have and , we recover previous results for .
Thus, for small enough, we have the norm less than a constant times
Appendix F Proof for Theorem 2
Finally, the initialization error term (III) can be bounded by using Theorem 1 (with ):
where .
To control , we now only work on the un-normalized distributions:
by repeating the arguments for smaller ’s and unrolling the recursion (and recall that by convention).
Finally, we transform back the errors in the algorithmic quantities that the FW algorithm measures:
We expect as the errors on the normalization constants could hopefully go in both direction and thus cancel each other, though in the worst case it could also grow with . Substituting back in (6), we get what we wanted to prove:
For parameter estimation in a HMM, one would also be interested in the quality of approximation for . We note that inequality (B) also gives us a bound on the relative error of our estimate for the normalization constant:
The disadvantage of the bound (7) is the presence of the quantity for which we did not provide an explicit upper bound (though we would expect it to be close to 1). To get an explicit upper bound for the error, we can repeat a similar argument but always working with the normalized quantities:
The term (II) is the normalization error which can bounded similarly as before as:
Similarly as before, we also have for (III) that by Theorem 1 (with ) that . Combining the three terms, we get:
Appendix G Faster rates for FW with approximate vertex search for the MMD objective
In this section, we provide the proofs for the rate of convergence for FW on the MMD objective when an approximate vertex search is used (as mentioned in Appendix B) by extending the proofs from Chen et al. (2010). We consider the step-size .We note that the rate extends to the line-search step-size as well as the improvement at each iteration can only be better in this case considering the proof technique that we use. We note that the standard step-size for Frank-Wolfe optimization to get a rate is .We also tried the step-size in the mixture of Gaussians experiment of Section 2.3, but it gave similar results as the step-size. The best rate known for general objectives when using FW with is actually \citepsup[Bound 3.2]freund2013FW. We make use of the specific form of the MMD objective here to prove the rate, as well as the faster rate under additional assumptions. For the rest of this section, we use to mean .
Consider the FW-Quad Algorithm 1 where an approximate vertex search is used: , where and . Suppose that lies in the strict interior of with a radius , i.e. a ball of radius centered at lies within . Recall that . Then we have the faster rate for the objective :
If (note that ), then we can still get a standard FW rate:
Proof If a ball of a radius centered at lies within , then we have that:
So the approximate vertex search yields with the property:
By using the FW update with the step-size, we get:
Thus if we let , then we get:
The last inequality used the crucial strict interior assumption that yielded (11). Now let . Note that . We will now proceed to show by induction that for . Note that the bracket in (12) is negative if and only if (i.e. in this case), giving the inspiration for the threshold.
by using the fact that since a ball of radius fitting in implies that the maximum norm of elements in is at least .
Now suppose that , i.e. that for some . Then (12) becomes:
The RHS is a convex function of , and so it is maximized at the boundary of its domain. For , we get . For , we get . And thus in general, supposing , we get that as:
using . This completes the induction step as this means that .
Thus we conclude that for all , i.e.
This shows the faster rate (9). If we do not have in the strict interior of , i.e. , then we can unroll the inequality (12) to get:
This translates to a slower rate on (with precision), but note that at least it does not have the factor from the rate by \citetsupfreund2013FW.
Going back over the argument from Appendix B, we said that using random search points in FW-Quad was similar to approximately solving (within ) the linear subproblem for the Frank-Wolfe optimization of over the marginal polytope of . We note that the marginal polytope of is at most -dimensional, and thus, by using a similar argument as in Proposition 1 of Bach et al. (2012), we could show that it contains a ball of radius centered at .We note that as is finite, we do not need to make the additional assumption that the kernel is continuous unlike in Proposition 1 of Bach et al. (2012). From (9) in Theorem G.1, we can thus conclude that:
This seems to give a faster rate, but the problem is that might shrink at an exponential rate with if is infinite dimensional. Thus even though is , the dependence of might be worse than the previously quoted rate of ; the latter is thus the general worst-case.
On the other hand, under the additional assumption that is finite dimensional and that there is a ball of radius centered around in (by using Proposition 1 of Bach et al. (2012) for example), then for a sufficiently large , we will have close to . Thus for large , we will have , and thus . This gives an asymptotically faster rate than the rate given in Appendix B arising from (10), but the constant is worse by a factor of .