Generalized filtering


Generalized filtering is a generic Bayesian filtering scheme for nonlinear state-space models. It is based on a variational principle of least action, formulated in generalized coordinates. Note that the concept of "generalized coordinates" as used here differs from the concept of generalized coordinates of motion as used in dynamical systems analysis. Generalized filtering furnishes posterior densities over hidden states generating observed data using a generalized gradient descent on variational free energy, under the Laplace assumption. Unlike classical 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 maximization and generalized predictive coding.

Definition

Definition: Generalized filtering rests on the tuple :
Here ~ denotes a variable in generalized coordinates of motion:

Generalized filtering

The objective is to approximate the posterior density over hidden and control states, given sensor states and a generative model – and estimate the model evidence to compare different models. This generally involves an intractable marginalization over hidden states, so model evidence is replaced with a variational free energy bound. Given the following definitions:
Denote the Shannon entropy of the density by. We can then write the variational free energy in two ways:
The second equality shows that minimizing variational free energy minimizes the Kullback-Leibler divergence between the variational and true posterior density and renders the variational free energy the negative log evidence. 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 :
The variational means that minimize the 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

Generalized 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
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 paths.
Remarks: Heuristically, generalized filtering performs a gradient descent on variational free energy in a moving frame of reference:, where the frame itself minimizes variational free energy. For a related example in statistical physics, see Kerr and Graham who use ensemble dynamics in generalized coordinates to provide a generalized phase-space version of Langevin and associated Fokker-Planck equations.
In practice, generalized filtering uses local linearization over intervals to recover discrete updates
This updates the means of hidden variables at each interval.

Generative (state-space) models in generalized coordinates

Usually, the generative density or model is specified in terms of a nonlinear input-state-output model with continuous nonlinear functions:
The corresponding generalized model 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 factorize into a covariance among variables and correlations among generalized 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. Crucially, the precision of high order derivatives fall to zero fairly quickly, which means it is only necessary to model relatively low order generalized motion for any given or parameterized autocorrelation function.

Special cases

Filtering discrete time series

When time series are observed as a discrete sequence of observations, the implicit sampling is treated as part of the generative process, where
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.

Generalized filtering and model parameters

For any slowly varying model parameters of the equations of motion or precision generalized filtering takes the following form
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.

Relationship to Bayesian filtering and predictive coding

Generalized filtering and Kalman filtering

Classical filtering under Markovian or Wiener 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 generalized 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 Kalman filtering.

Generalized filtering and particle filtering

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

Generalized filtering and 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 generalized filtering, this leads to dynamic expectation maximisation. that comprises a D-step that optimizes the sufficient statistics of unknown states, an E-step for parameters and an M-step for precisions.

Generalized filtering and predictive coding

Generalized filtering is usually used to invert hierarchical models of the following form
The ensuing generalized gradient descent on free energy can then be expressed compactly in terms of prediction errors, where :
Here, is the precision of random fluctuations at the i-th level. This is known as generalized predictive coding , with linear predictive coding as a special case.

Applications

Generalized 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 systems generating data. It is also used to simulate inference in terms of generalized predictive coding in the brain.