From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Generalized filtering is a generic Bayesian filtering scheme for nonlinear state-space models [1]. It is based on a variational principle of least action, formulated in generalized coordinates of motion [2]. Generalized filtering furnishes posterior densities over hidden states (and parameters) generating observed data using a generalized gradient decent on variational free energy, under the Laplace assumption. Unlike classical (e.g., Kalman-Bucy or particle) filtering, generalized filtering eschews Markovian assumptions about random fluctuations. Furthermore, it operates online, assimilating data to approximate the posterior density over unknown quantities, without the need for a backward pass. Special cases include variational filtering, dynamic expectation maximisation and generalised predictive coding.


Definition: Generalized filtering rests on the tuple :

  • A sample space from which random fluctuations are drawn
  • Hidden states – that cause sensor states and depend on control states
  • Sensor states – a probabilistic mapping from hidden and control states
  • Control states – that act as external causes, input or forcing terms
  • Generative density – over sensory, hidden and control states under a generative model
  • Variational density – over hidden and control states with mean

Here ~ denotes a variable in generalised coordinates of motion:

Generalised filtering[edit]

The objective is to approximate the posterior density over hidden and control states, given sensor states and a generative model – and estimate the (path integral of) model evidence to compare different models. This generally involves an intractable marginalization over hidden states, so model evidence (or marginal likelihood) is replaced with a variational free energy bound [3]:

The second equality shows that minimizing variational free energy (i) minimizes the Kullback-Leibler divergence between the variational and true posterior density and (ii) renders the variational free energy (a bound approximation to) the negative log evidence (because the divergence can never be less than zero) [4]. Under the Laplace assumption the variational density is Gaussian and the precision that minimizes free energy is . This means that free-energy can be expressed in terms of the variational mean [5] (omitting constants):

The variational means that minimize the (path integral) of free energy can now be recovered by solving the generalized filter:

Where, is a block matrix derivative operator of identify matrices such that

Variational basis[edit]

Generalised filtering is based on the following lemma: The self-consistent solution to satisfies the variational principle of stationary action, where action is the path integral of variational free energy

Proof: self-consistency requires the motion of the mean to be the mean of the motion and (by the fundamental lemma of variational calculus)

Put simply, small perturbations to the path of the mean do not change variational free energy and it has the least action of all possible (local) paths.

Remarks: Heuristically, generalised filtering performs a gradient decent on variational free energy in a moving frame of reference: , where the frame itself minimises variational free energy. For a related example in statistical physics, see Kerr and Graham [6] who use ensemble dynamics in generalised coordinates to provide a generalised phase-space version of Langevin and associated Fokker-Planck equations.

In practice, generalised filtering uses local linearization [7] over intervals to recover discrete updates

This updates the means of hidden variables at each interval (usually the interval between observations).

Generative (state-space) models in generalised coordinates[edit]

Usually, the generative density or model is specified in terms of a nonlinear input-state-output model with continuous nonlinear functions:

The corresponding generalised model (under local linearity assumptions) obtains the from the chain rule

Gaussian assumptions about the random fluctuations then prescribe the likelihood and empirical priors on the motion of hidden states

The covariances factorise into a covariance among variables and correlations among generalised fluctuations that encodes their autocorrelation:

Here, is the second derivative of the autocorrelation function evaluated at zero. This is a ubiquitous measure of roughness in the theory of stochastic processes [8]. Crucially, the precision (inverse variance) of high order derivatives fall to zero fairly quickly, which means it is only necessary to model relatively low order generalised motion (usually between two and eight) for any given or parameterized autocorrelation function.

Special cases[edit]

Filtering discrete time series[edit]

When time series are observed as a discrete sequence of observations, the implicit sampling is treated as part of the generative process, where (using Taylor's theorem)

In principle, the entire sequence could be used to estimate hidden variables at each point in time. However, the precision of samples in the past and future falls quickly and can be ignored. This allows the scheme to assimilate data online, using local observations around each time point (typically between and eight).

Generalised filtering and model parameters[edit]

For any slowly varying model parameters of the equations of motion or precision generalised filtering takes the following form (where corresponds to the variational mean of the parameters)

Here, the solution minimizes variational free energy, when the motion of the mean is small. This can be seen by noting . It is straightforward to show that this solution corresponds to a classical Newton update [9].

Relationship to Bayesian filtering and predictive coding[edit]

Generalised filtering and Kalman filtering[edit]

Classical filtering under Markovian or Weiner assumptions is equivalent to assuming the precision of the motion of random fluctuations is zero. In this limiting case, one only has to consider the states and their first derivative . This means generalised filtering takes the form of a Kalman-Bucy filter, with prediction and correction terms:

Substituting this first-order filtering into the discrete update scheme above gives the equivalent of (extended) Kalman filtering [10].

Generalised filtering and particle filtering[edit]

Particle filtering is a sampling-based scheme that relaxes assumptions about the form of the variational or approximate posterior density. The corresponding generalised filtering scheme is called variational filtering [11]. In variational filtering, an ensemble of particles diffuse over the free energy landscape in a frame of reference that moves with the expected (generalised) motion of the ensemble. This provides a relatively simple scheme that eschews Gaussian (unimodal) assumptions. Unlike particle filtering it does not require proposal densities -- or the elimination or creation of particles.

Generalised filtering and variational Bayes[edit]

Variational Bayes rests on a mean field partition of the variational density:

This partition induces a variational update or step for each marginal density -- that is usually solved analytically using conjugate priors. In generalised filtering, this leads to dynamic expectation maximisation [12]. that comprises a D-step that optimises the sufficient statistics of unknown states, an E-step for parameters and an M-step for precisions.

Generalised filtering and predictive coding[edit]

Generalised filtering is usually used to invert hierarchical models of the following form

The ensuing generalised gradient descent on free energy can then be expressed compactly in terms of prediction errors, where (omitting high order terms):

Here, is the precision of random fluctuations at the$ i$-th level. This is known as generalised predictive coding [11], with linear predictive coding as a special case.


Generalised filtering has been primarily applied to biological timeseries -- in particular functional magnetic resonance imaging and electrophysiological data. This is usually in the context of dynamic causal modelling to make inferences about the underlying architectures of (neuronal) systems generating data [13]. It is also used to simulate inference in terms of generalised (hierarchical) predictive coding in the brain [14].

See also[edit]


  1. ^ K Friston, K Stephan, B Li, and J. Daunizeau, "Generalised Filtering," Mathematical Problems in Engineering, vol. vol., 2010, p. 621670, 2010.
  2. ^ B Balaji and K Friston, "Bayesian state estimation using generalized coordinates," Proc. SPIE, p. 80501Y , 2011
  3. ^ R P Feynman, Statistical mechanics. Reading MA: Benjamin, 1972
  4. ^ M J Beal, "Variational Algorithms for Approximate Bayesian Inference," PhD. Thesis, University College London, 2003.
  5. ^ K Friston, J Mattout, N Trujillo-Barreto, J Ashburner, and W Penny, "Variational free energy and the Laplace approximation," NeuroImage, vol. 34, no. 1, pp. 220-34, 2007
  6. ^ W C Kerr and A J Graham, "Generalised phase space version of Langevin equations and associated Fokker-Planck equations," Eur. Phys. J. B., vol. 15, pp. 305-11, 2000.
  7. ^ T Ozaki, "A bridge between nonlinear time-series models and nonlinear stochastic dynamical systems: A local linearization approach," Statistica Sin., vol. 2, pp. 113-135, 1992
  8. ^ D R Cox and H D Miller, The theory of stochastic processes. London: Methuen, 1965.
  9. ^ K Friston, K Stephan, B Li, and J. Daunizeau, "Generalised Filtering," Mathematical Problems in Engineering, vol. vol., 2010, p. 621670, 2010.
  10. ^ K J Friston, N Trujillo-Barreto, and J Daunizeau, "DEM: A variational treatment of dynamic systems," Neuroimage, vol. 41, no. 3, pp. 849-85, 2008
  11. ^ K J Friston, "Variational filtering," Neuroimage, vol. 41, no. 3, pp. 747-66, 2008.
  12. ^ K J Friston, N Trujillo-Barreto, and J Daunizeau, "DEM: A variational treatment of dynamic systems," Neuroimage, vol. 41, no. 3, pp. 849-85, 2008
  13. ^ J Daunizeau, O David, and K E Stephan, "Dynamic causal modelling: a critical review of the biophysical and statistical foundations," Neuroimage, vol. 58, no. 2, pp. 312-22, 2011
  14. ^ K Friston, "Hierarchical models in the brain," PLoS Comput Biol., vol. 4, no. 11, p. e1000211, 2008.

External links[edit]

Category:Systems Category:Systems theory Category:Control theory Category:Nonlinear filters Category:Linear filters Category:Signal estimation Category:Stochastic differential equations Category:Markov models