Bayesian programming

From HandWiki

Bayesian programming is a formalism and a methodology for having a technique to specify probabilistic models and solve problems when less than the necessary information is available.

Edwin T. Jaynes proposed that probability could be considered as an alternative and an extension of logic for rational reasoning with incomplete and uncertain information. In his founding book Probability Theory: The Logic of Science[1] he developed this theory and proposed what he called “the robot,” which was not a physical device, but an inference engine to automate probabilistic reasoning—a kind of Prolog for probability instead of logic. Bayesian programming[2] is a formal and concrete implementation of this "robot".

Bayesian programming may also be seen as an algebraic formalism to specify graphical models such as, for instance, Bayesian networks, dynamic Bayesian networks, Kalman filters or hidden Markov models. Indeed, Bayesian Programming is more general than Bayesian networks and has a power of expression equivalent to probabilistic factor graphs.[3]

Formalism

A Bayesian program is a means of specifying a family of probability distributions.

The constituent elements of a Bayesian program are presented below:[4]

[math]\displaystyle{ \text{Program} \begin{cases} \text{Description} \begin{cases} \text{Specification} (\pi) \begin{cases} \text{Variables}\\ \text{Decomposition}\\ \text{Forms}\\ \end{cases}\\ \text{Identification (based on }\delta) \end{cases}\\ \text{Question} \end{cases} }[/math]
  1. A program is constructed from a description and a question.
  2. A description is constructed using some specification ([math]\displaystyle{ \pi }[/math]) as given by the programmer and an identification or learning process for the parameters not completely specified by the specification, using a data set ([math]\displaystyle{ \delta }[/math]).
  3. A specification is constructed from a set of pertinent variables, a decomposition and a set of forms.
  4. Forms are either parametric forms or questions to other Bayesian programs.
  5. A question specifies which probability distribution has to be computed.

Description

The purpose of a description is to specify an effective method of computing a joint probability distribution on a set of variables [math]\displaystyle{ \left\{ X_{1},X_{2},\cdots,X_{N}\right\} }[/math] given a set of experimental data [math]\displaystyle{ \delta }[/math] and some specification [math]\displaystyle{ \pi }[/math]. This joint distribution is denoted as: [math]\displaystyle{ P\left(X_{1}\wedge X_{2}\wedge\cdots\wedge X_{N}\mid\delta\wedge\pi\right) }[/math].[5]

To specify preliminary knowledge [math]\displaystyle{ \pi }[/math], the programmer must undertake the following:

  1. Define the set of relevant variables [math]\displaystyle{ \left\{ X_{1},X_{2},\cdots,X_{N}\right\} }[/math] on which the joint distribution is defined.
  2. Decompose the joint distribution (break it into relevant independent or conditional probabilities).
  3. Define the forms of each of the distributions (e.g., for each variable, one of the list of probability distributions).

Decomposition

Given a partition of [math]\displaystyle{ \left\{ X_{1},X_{2},\ldots,X_{N}\right\} }[/math] containing [math]\displaystyle{ K }[/math] subsets, [math]\displaystyle{ K }[/math] variables are defined [math]\displaystyle{ L_{1},\cdots,L_{K} }[/math], each corresponding to one of these subsets. Each variable [math]\displaystyle{ L_{k} }[/math] is obtained as the conjunction of the variables [math]\displaystyle{ \left\{ X_{k_{1}},X_{k_{2}},\cdots\right\} }[/math] belonging to the [math]\displaystyle{ k^{th} }[/math] subset. Recursive application of Bayes' theorem leads to:

[math]\displaystyle{ \begin{align} & P\left(X_{1}\wedge X_{2}\wedge\cdots\wedge X_{N}\mid\delta\wedge\pi\right)\\ ={} & P\left(L_{1}\wedge\cdots\wedge L_{K}\mid\delta\wedge\pi\right)\\ ={} & P\left(L_{1}\mid\delta\wedge\pi\right)\times P\left(L_{2}\mid L_{1}\wedge\delta\wedge\pi\right) \times\cdots\times P\left(L_{K}\mid L_{K-1}\wedge\cdots\wedge L_{1}\wedge\delta\wedge\pi\right)\end{align} }[/math]

Conditional independence hypotheses then allow further simplifications. A conditional independence hypothesis for variable [math]\displaystyle{ L_{k} }[/math] is defined by choosing some variable [math]\displaystyle{ X_{n} }[/math] among the variables appearing in the conjunction [math]\displaystyle{ L_{k-1}\wedge\cdots\wedge L_{2}\wedge L_{1} }[/math], labelling [math]\displaystyle{ R_{k} }[/math] as the conjunction of these chosen variables and setting:

[math]\displaystyle{ P \left(L_{k}\mid L_{k-1}\wedge\cdots\wedge L_{1}\wedge\delta\wedge\pi\right ) = P\left( L_{k} \mid R_{k}\wedge\delta\wedge\pi \right) }[/math]

We then obtain:

[math]\displaystyle{ \begin{align} & P\left(X_{1}\wedge X_{2}\wedge\cdots\wedge X_{N}\mid\delta\wedge\pi\right)\\ ={} & P\left(L_{1}\mid\delta\wedge\pi\right)\times P\left(L_{2}\mid R_{2}\wedge\delta\wedge\pi\right)\times\cdots\times P\left(L_{K}\mid R_{K}\wedge\delta\wedge\pi\right)\end{align} }[/math]

Such a simplification of the joint distribution as a product of simpler distributions is called a decomposition, derived using the chain rule.

This ensures that each variable appears at the most once on the left of a conditioning bar, which is the necessary and sufficient condition to write mathematically valid

Forms

Each distribution [math]\displaystyle{ P\left(L_{k}\mid R_{k}\wedge\delta\wedge\pi\right) }[/math] appearing in the product is then associated with either a parametric form (i.e., a function [math]\displaystyle{ f_{\mu}\left(L_{k}\right) }[/math]) or a question to another Bayesian program [math]\displaystyle{ P\left(L_{k}\mid R_{k} \wedge \delta \wedge \pi \right) = P\left(L\mid R\wedge\widehat{\delta}\wedge\widehat{\pi}\right) }[/math].

When it is a form [math]\displaystyle{ f_{\mu}\left(L_{k}\right) }[/math], in general, [math]\displaystyle{ \mu }[/math] is a vector of parameters that may depend on [math]\displaystyle{ R_{k} }[/math] or [math]\displaystyle{ \delta }[/math] or both. Learning takes place when some of these parameters are computed using the data set [math]\displaystyle{ \delta }[/math].

An important feature of Bayesian Programming is this capacity to use questions to other Bayesian programs as components of the definition of a new Bayesian program. [math]\displaystyle{ P\left(L_{k}\mid R_{k}\wedge\delta\wedge\pi\right) }[/math] is obtained by some inferences done by another Bayesian program defined by the specifications [math]\displaystyle{ \widehat{\pi} }[/math] and the data [math]\displaystyle{ \widehat{\delta} }[/math]. This is similar to calling a subroutine in classical programming and provides an easy way to build hierarchical models.

Question

Given a description (i.e., [math]\displaystyle{ P\left(X_{1}\wedge X_{2}\wedge\cdots\wedge X_{N}\mid\delta\wedge\pi\right) }[/math]), a question is obtained by partitioning [math]\displaystyle{ \left\{ X_{1},X_{2},\cdots,X_{N}\right\} }[/math] into three sets: the searched variables, the known variables and the free variables.

The 3 variables [math]\displaystyle{ Searched }[/math], [math]\displaystyle{ Known }[/math] and [math]\displaystyle{ Free }[/math] are defined as the conjunction of the variables belonging to these sets.

A question is defined as the set of distributions:

[math]\displaystyle{ P\left(Searched\mid \text{Known}\wedge\delta\wedge\pi\right) }[/math]

made of many "instantiated questions" as the cardinal of [math]\displaystyle{ Known }[/math], each instantiated question being the distribution:

[math]\displaystyle{ P\left(\text{Searched}\mid\text{Known}\wedge\delta\wedge\pi\right) }[/math]

Inference

Given the joint distribution [math]\displaystyle{ P\left(X_{1}\wedge X_{2}\wedge\cdots\wedge X_{N}\mid\delta\wedge\pi\right) }[/math], it is always possible to compute any possible question using the following general inference:

[math]\displaystyle{ \begin{align} & P\left(\text{Searched}\mid\text{Known}\wedge\delta\wedge\pi\right)\\ ={} & \sum_\text{Free}\left[P\left( \text{Searched} \wedge \text{Free} \mid \text{Known}\wedge\delta\wedge\pi\right)\right]\\ ={} & \frac{\displaystyle \sum_\text{Free}\left[P\left(\text{Searched}\wedge \text{Free}\wedge \text{Known}\mid\delta\wedge\pi\right)\right]}{\displaystyle P\left(\text{Known}\mid\delta\wedge\pi\right)}\\ ={} & \frac{\displaystyle \sum_\text{Free}\left[P\left(\text{Searched}\wedge \text{Free}\wedge \text{Known}\mid\delta\wedge\pi\right)\right]}{\displaystyle \sum_{\text{Free}\wedge \text{Searched}} \left[P\left(\text{Searched} \wedge \text{Free} \wedge \text{Known}\mid\delta\wedge\pi\right)\right]}\\ ={} & \frac{1}{Z}\times\sum_\text{Free}\left[P\left(\text{Searched}\wedge \text{Free} \wedge \text{Known} \mid \delta\wedge\pi\right)\right]\end{align} }[/math]

where the first equality results from the marginalization rule, the second results from Bayes' theorem and the third corresponds to a second application of marginalization. The denominator appears to be a normalization term and can be replaced by a constant [math]\displaystyle{ Z }[/math].

Theoretically, this allows to solve any Bayesian inference problem. In practice, however, the cost of computing exhaustively and exactly [math]\displaystyle{ P\left(\text{Searched} \mid \text{Known} \wedge\delta\wedge\pi\right) }[/math] is too great in almost all cases.

Replacing the joint distribution by its decomposition we get:

[math]\displaystyle{ \begin{align} & P\left(\text{Searched}\mid \text{Known}\wedge\delta\wedge\pi\right)\\ = {}& \frac{1}{Z} \sum_\text{Free} \left[\prod_{k=1}^K \left[ P\left( L_{i}\mid K_{i} \wedge \pi \right)\right]\right] \end{align} }[/math]

which is usually a much simpler expression to compute, as the dimensionality of the problem is considerably reduced by the decomposition into a product of lower dimension distributions.

Example

Bayesian spam detection

The purpose of Bayesian spam filtering is to eliminate junk e-mails.

The problem is very easy to formulate. E-mails should be classified into one of two categories: non-spam or spam. The only available information to classify the e-mails is their content: a set of words. Using these words without taking the order into account is commonly called a bag of words model.

The classifier should furthermore be able to adapt to its user and to learn from experience. Starting from an initial standard setting, the classifier should modify its internal parameters when the user disagrees with its own decision. It will hence adapt to the user's criteria to differentiate between non-spam and spam. It will improve its results as it encounters increasingly classified e-mails.

Variables

The variables necessary to write this program are as follows:

  1. [math]\displaystyle{ Spam }[/math]: a binary variable, false if the e-mail is not spam and true otherwise.
  2. [math]\displaystyle{ W_0,W_1, \ldots, W_{N-1} }[/math]: [math]\displaystyle{ N }[/math] binary variables. [math]\displaystyle{ W_n }[/math] is true if the [math]\displaystyle{ n^{th} }[/math] word of the dictionary is present in the text.

These [math]\displaystyle{ N + 1 }[/math] binary variables sum up all the information about an e-mail.

Decomposition

Starting from the joint distribution and applying recursively Bayes' theorem we obtain:

[math]\displaystyle{ \begin{align} & P(\text{Spam}\wedge W_{0}\wedge\cdots\wedge W_{N-1})\\ ={} & P(\text{Spam})\times P(W_0 \mid \text{Spam})\times P(W_1 \mid \text{Spam} \wedge W_0)\\ & \times\cdots\\ & \times P\left(W_{N-1}\mid\text{Spam}\wedge W_{0}\wedge\cdots\wedge W_{N-2}\right)\end{align} }[/math]

This is an exact mathematical expression.

It can be drastically simplified by assuming that the probability of appearance of a word knowing the nature of the text (spam or not) is independent of the appearance of the other words. This is the naive Bayes assumption and this makes this spam filter a naive Bayes model.

For instance, the programmer can assume that:

[math]\displaystyle{ P(W_1\mid\text{Spam} \land W_0) = P(W_1\mid\text{Spam}) }[/math]

to finally obtain:

[math]\displaystyle{ P(\text{Spam} \land W_0 \land \ldots \land W_{N-1}) = P(\text{Spam})\prod_{n=0}^{N-1}[P(W_n\mid\text{Spam})] }[/math]

This kind of assumption is known as the naive Bayes' assumption. It is "naive" in the sense that the independence between words is clearly not completely true. For instance, it completely neglects that the appearance of pairs of words may be more significant than isolated appearances. However, the programmer may assume this hypothesis and may develop the model and the associated inferences to test how reliable and efficient it is.

Parametric forms

To be able to compute the joint distribution, the programmer must now specify the [math]\displaystyle{ N + 1 }[/math] distributions appearing in the decomposition:

  1. [math]\displaystyle{ P(\text{Spam}) }[/math] is a prior defined, for instance, by [math]\displaystyle{ P([\text{Spam}=1]) = 0.75 }[/math]
  2. Each of the [math]\displaystyle{ N }[/math] forms [math]\displaystyle{ P(W_n\mid\text{Spam}) }[/math] may be specified using Laplace rule of succession (this is a pseudocounts-based smoothing technique to counter the zero-frequency problem of words never-seen-before):
    1. [math]\displaystyle{ P(W_n\mid[\text{Spam}=\text{false}])=\frac{1+a^n_f}{2+a_f} }[/math]
    2. [math]\displaystyle{ P(W_n\mid[\text{Spam}=\text{true}])=\frac{1+a^n_t}{2+a_t} }[/math]

where [math]\displaystyle{ a^n_f }[/math] stands for the number of appearances of the [math]\displaystyle{ n^{th} }[/math] word in non-spam e-mails and [math]\displaystyle{ a_f }[/math] stands for the total number of non-spam e-mails. Similarly, [math]\displaystyle{ a_t^n }[/math] stands for the number of appearances of the [math]\displaystyle{ n^{th} }[/math] word in spam e-mails and [math]\displaystyle{ a_t }[/math] stands for the total number of spam e-mails.

Identification

The [math]\displaystyle{ N }[/math] forms [math]\displaystyle{ P(W_n\mid\text{Spam}) }[/math] are not yet completely specified because the [math]\displaystyle{ 2N + 2 }[/math] parameters [math]\displaystyle{ a_f^{n=0, \ldots, N-1} }[/math], [math]\displaystyle{ a_t^{n=0, \ldots, N-1} }[/math], [math]\displaystyle{ a_f }[/math] and [math]\displaystyle{ a_t }[/math] have no values yet.

The identification of these parameters could be done either by batch processing a series of classified e-mails or by an incremental updating of the parameters using the user's classifications of the e-mails as they arrive.

Both methods could be combined: the system could start with initial standard values of these parameters issued from a generic database, then some incremental learning customizes the classifier to each individual user.

Question

The question asked to the program is: "what is the probability for a given text to be spam knowing which words appear and don't appear in this text?" It can be formalized by:

[math]\displaystyle{ P (\text{Spam}\mid w_0 \wedge\cdots\wedge w_{N-1} ) }[/math]

which can be computed as follows:

[math]\displaystyle{ \begin{align} & P(\text{Spam}\mid w_{0}\wedge\cdots\wedge w_{N-1} )\\ ={} & \frac{\displaystyle P(\text{Spam}) \prod_{n=0}^{N-1} [ P(w_{n}\mid\text{Spam})]}{\displaystyle \sum_\text{Spam} [P(\text{Spam}) \prod_{n=0}^{N-1} [P (w_{n}\mid\text{Spam})]]}\end{align} }[/math]

The denominator appears to be a normalization constant. It is not necessary to compute it to decide if we are dealing with spam. For instance, an easy trick is to compute the ratio:

[math]\displaystyle{ \begin{align} & \frac{P([\text{Spam}=\text{true}]\mid w_0\wedge\cdots\wedge w_{N-1})}{P([ \text{Spam} = \text{false} ]\mid w_0 \wedge\cdots\wedge w_{N-1})}\\ ={} & \frac{P([ \text{Spam}=\text{true} ] )}{P([ \text{Spam} =\text{false} ])}\times\prod_{n=0}^{N-1} \left[\frac{P(w_n\mid [\text{Spam}=\text{true}])}{P(w_n\mid [\text{Spam} = \text{false}])}\right] \end{align} }[/math]

This computation is faster and easier because it requires only [math]\displaystyle{ 2N }[/math] products.

Bayesian program

The Bayesian spam filter program is completely defined by:

[math]\displaystyle{ \Pr \begin{cases} Ds \begin{cases} Sp (\pi) \begin{cases} Va: \text{Spam},W_0,W_1 \ldots W_{N-1} \\ Dc: \begin{cases} P(\text{Spam} \land W_0 \land \ldots \land W_n \land \ldots \land W_{N-1})\\ = P(\text{Spam})\prod_{n=0}^{N-1}P(W_n\mid\text{Spam}) \end{cases}\\ Fo: \begin{cases} P(\text{Spam}): \begin{cases} P([\text{Spam}=\text{false}])=0.25 \\ P([\text{Spam}=\text{true}])=0.75 \end{cases}\\ P(W_n\mid\text{Spam}): \begin{cases} P(W_n\mid[\text{Spam}=\text{false}])\\ =\frac{1+a^n_f}{2+a_f} \\ P(W_n\mid[\text{Spam}=\text{true}])\\ =\frac{1+a^n_t}{2+a_t} \end{cases} \\ \end{cases}\\ \end{cases}\\ \text{Identification (based on }\delta) \end{cases}\\ Qu: P(\text{Spam}\mid w_0 \land \ldots \land w_n \land \ldots \land w_{N-1}) \end{cases} }[/math]

Bayesian filter, Kalman filter and hidden Markov model

Bayesian filters (often called Recursive Bayesian estimation) are generic probabilistic models for time evolving processes. Numerous models are particular instances of this generic approach, for instance: the Kalman filter or the Hidden Markov model (HMM).

Variables

  • Variables [math]\displaystyle{ S^{0},\ldots,S^{T} }[/math] are a time series of state variables considered to be on a time horizon ranging from [math]\displaystyle{ 0 }[/math] to [math]\displaystyle{ T }[/math].
  • Variables [math]\displaystyle{ O^{0},\ldots,O^{T} }[/math] are a time series of observation variables on the same horizon.

Decomposition

The decomposition is based:

  • on [math]\displaystyle{ P(S^t \mid S^{t-1}) }[/math], called the system model, transition model or dynamic model, which formalizes the transition from the state at time [math]\displaystyle{ t-1 }[/math] to the state at time [math]\displaystyle{ t }[/math];
  • on [math]\displaystyle{ P(O^t\mid S^t) }[/math], called the observation model, which expresses what can be observed at time [math]\displaystyle{ t }[/math] when the system is in state [math]\displaystyle{ S^t }[/math];
  • on an initial state at time [math]\displaystyle{ 0 }[/math]: [math]\displaystyle{ P(S^0 \wedge O^0) }[/math].

Parametrical forms

The parametrical forms are not constrained and different choices lead to different well-known models: see Kalman filters and Hidden Markov models just below.

Question

The typical question for such models is [math]\displaystyle{ P\left(S^{t+k}\mid O^{0}\wedge\cdots\wedge O^{t}\right) }[/math]: what is the probability distribution for the state at time [math]\displaystyle{ t + k }[/math] knowing the observations from instant [math]\displaystyle{ 0 }[/math] to [math]\displaystyle{ t }[/math]?

The most common case is Bayesian filtering where [math]\displaystyle{ k=0 }[/math], which searches for the present state, knowing past observations.

However, it is also possible [math]\displaystyle{ (k\gt 0) }[/math], to extrapolate a future state from past observations, or to do smoothing [math]\displaystyle{ (k\lt 0) }[/math], to recover a past state from observations made either before or after that instant.

More complicated questions may also be asked as shown below in the HMM section.

Bayesian filters [math]\displaystyle{ (k=0) }[/math] have a very interesting recursive property, which contributes greatly to their attractiveness. [math]\displaystyle{ P\left(S^{t}|O^{0}\wedge\cdots\wedge O^{t}\right) }[/math] may be computed simply from [math]\displaystyle{ P\left(S^{t-1}\mid O^0 \wedge \cdots \wedge O^{t-1}\right) }[/math] with the following formula:

[math]\displaystyle{ \begin{array}{ll} & P\left(S^{t}|O^{0}\wedge\cdots\wedge O^{t}\right)\\ = & P\left(O^{t}|S^{t}\right)\times\sum_{S^{t-1}}\left[P\left(S^{t}|S^{t-1}\right)\times P\left(S^{t-1}|O^{0}\wedge\cdots\wedge O^{t-1}\right)\right]\end{array} }[/math]

Another interesting point of view for this equation is to consider that there are two phases: a prediction phase and an estimation phase:

  • During the prediction phase, the state is predicted using the dynamic model and the estimation of the state at the previous moment:
[math]\displaystyle{ \begin{array}{ll} & P\left(S^{t}|O^{0}\wedge\cdots\wedge O^{t-1}\right)\\ = & \sum_{S^{t-1}}\left[P\left(S^{t}|S^{t-1}\right)\times P\left(S^{t-1}|O^{0}\wedge\cdots\wedge O^{t-1}\right)\right]\end{array} }[/math]
  • During the estimation phase, the prediction is either confirmed or invalidated using the last observation:
[math]\displaystyle{ \begin{align} & P\left(S^{t}\mid O^{0}\wedge\cdots\wedge O^{t}\right)\\ ={} & P\left(O^{t}\mid S^{t}\right)\times P\left(S^{t}|O^{0}\wedge\cdots\wedge O^{t-1}\right) \end{align} }[/math]

Bayesian program

[math]\displaystyle{ Pr\begin{cases} Ds\begin{cases} Sp(\pi)\begin{cases} Va:\\ S^{0},\cdots,S^{T},O^{0},\cdots,O^{T}\\ Dc:\\ \begin{cases} & P\left(S^{0}\wedge\cdots\wedge S^{T}\wedge O^{0}\wedge\cdots\wedge O^{T}|\pi\right)\\ = & P\left(S^{0}\wedge O^{0}\right)\times\prod_{t=1}^{T}\left[P\left(S^{t}|S^{t-1}\right)\times P\left(O^{t}|S^{t}\right)\right]\end{cases}\\ Fo:\\ \begin{cases} P\left(S^{0}\wedge O^{0}\right)\\ P\left(S^{t}|S^{t-1}\right)\\ P\left(O^{t}|S^{t}\right)\end{cases}\end{cases}\\ Id\end{cases}\\ Qu:\\ \begin{cases} \begin{array}{l} P\left(S^{t+k}|O^{0}\wedge\cdots\wedge O^{t}\right)\\ \left(k=0\right)\equiv \text{Filtering} \\ \left(k\gt 0\right)\equiv \text{Prediction} \\ \left(k\lt 0\right)\equiv \text{Smoothing} \end{array}\end{cases}\end{cases} }[/math]

Kalman filter

The very well-known Kalman filters[6] are a special case of Bayesian filters.

They are defined by the following Bayesian program:

[math]\displaystyle{ Pr\begin{cases} Ds\begin{cases} Sp(\pi)\begin{cases} Va:\\ S^{0},\cdots,S^{T},O^{0},\cdots,O^{T}\\ Dc:\\ \begin{cases} & P\left(S^{0}\wedge\cdots\wedge O^{T}|\pi\right)\\ = & \left[\begin{array}{c} P\left(S^{0}\wedge O^{0}|\pi\right)\\ \prod_{t=1}^{T}\left[P\left(S^{t}|S^{t-1}\wedge\pi\right)\times P\left(O^{t}|S^{t}\wedge\pi\right)\right]\end{array}\right]\end{cases}\\ Fo:\\ \begin{cases} P\left(S^t \mid S^{t-1}\wedge\pi\right)\equiv G\left(S^{t},A\bullet S^{t-1},Q\right)\\ P\left(O^t \mid S^t \wedge\pi\right)\equiv G\left(O^{t},H\bullet S^{t},R\right)\end{cases}\end{cases}\\ Id\end{cases}\\ Qu:\\ P\left(S^T \mid O^0 \wedge\cdots\wedge O^{T}\wedge\pi\right)\end{cases} }[/math]
  • Variables are continuous.
  • The transition model [math]\displaystyle{ P(S^t \mid S^{t-1}\wedge\pi) }[/math] and the observation model [math]\displaystyle{ P(O^t \mid S^t \wedge\pi) }[/math] are both specified using Gaussian laws with means that are linear functions of the conditioning variables.

With these hypotheses and by using the recursive formula, it is possible to solve the inference problem analytically to answer the usual [math]\displaystyle{ P(S^T \mid O^0 \wedge\cdots\wedge O^T \wedge\pi) }[/math] question. This leads to an extremely efficient algorithm, which explains the popularity of Kalman filters and the number of their everyday applications.

When there are no obvious linear transition and observation models, it is still often possible, using a first-order Taylor's expansion, to treat these models as locally linear. This generalization is commonly called the extended Kalman filter.

Hidden Markov model

Hidden Markov models (HMMs) are another very popular specialization of Bayesian filters.

They are defined by the following Bayesian program:

[math]\displaystyle{ \Pr\begin{cases} Ds\begin{cases} Sp(\pi)\begin{cases} Va:\\ S^{0},\ldots,S^{T},O^{0},\ldots,O^{T}\\ Dc:\\ \begin{cases} & P\left(S^{0}\wedge\cdots\wedge O^{T}\mid\pi\right)\\ = & \left[\begin{array}{c} P\left(S^{0}\wedge O^{0}\mid\pi\right)\\ \prod_{t=1}^{T}\left[P\left(S^{t}\mid S^{t-1}\wedge\pi\right)\times P\left(O^{t}\mid S^{t}\wedge\pi\right)\right]\end{array}\right]\end{cases}\\ Fo:\\ \begin{cases} P\left(S^{0}\wedge O^{0}\mid\pi\right)\equiv \text{Matrix}\\ P\left(S^{t}\mid S^{t-1}\wedge\pi\right)\equiv \text{Matrix}\\ P\left(O^{t}\mid S^{t}\wedge\pi\right)\equiv \text{Matrix}\end{cases}\end{cases}\\ Id\end{cases}\\ Qu:\\ \max_{S^{1}\wedge\cdots\wedge S^{T-1}}\left[P\left(S^{1}\wedge\cdots\wedge S^{T-1}\mid S^{T}\wedge O^{0}\wedge\cdots\wedge O^{T}\wedge\pi\right)\right]\end{cases} }[/math]
  • Variables are treated as being discrete.
  • The transition model [math]\displaystyle{ P\left(S^{t}\mid S^{t-1}\wedge\pi\right) }[/math] and the observation model [math]\displaystyle{ P\left(O^{t}\mid S^{t}\wedge\pi\right) }[/math] are

both specified using probability matrices.

  • The question most frequently asked of HMMs is:
[math]\displaystyle{ \max_{S^{1}\wedge\cdots\wedge S^{T-1}}\left[P\left(S^{1}\wedge\cdots\wedge S^{T-1}\mid S^{T}\wedge O^{0}\wedge\cdots\wedge O^{T}\wedge\pi\right)\right] }[/math]

What is the most probable series of states that leads to the present state, knowing the past observations?

This particular question may be answered with a specific and very efficient algorithm called the Viterbi algorithm.

The Baum–Welch algorithm has been developed for HMMs.

Applications

Academic applications

Since 2000, Bayesian programming has been used to develop both robotics applications and life sciences models.[7]

Robotics

In robotics, bayesian programming was applied to autonomous robotics,[8][9][10][11][12] robotic CAD systems,[13] advanced driver-assistance systems,[14] robotic arm control, mobile robotics,[15][16] human-robot interaction,[17] human-vehicle interaction (Bayesian autonomous driver models)[18][19][20][21][22] video game avatar programming and training [23] and real-time strategy games (AI).[24]

Life sciences

In life sciences, bayesian programming was used in vision to reconstruct shape from motion,[25] to model visuo-vestibular interaction[26] and to study saccadic eye movements;[27] in speech perception and control to study early speech acquisition[28] and the emergence of articulatory-acoustic systems;[29] and to model handwriting perception and control.[30]

Pattern recognition

Bayesian program learning has potential applications voice recognition and synthesis, image recognition and natural language processing. It employs the principles of compositionality (building abstract representations from parts), causality (building complexity from parts) and learning to learn (using previously recognized concepts to ease the creation of new concepts).[31]

Possibility theories

The comparison between probabilistic approaches (not only bayesian programming) and possibility theories continues to be debated.

Possibility theories like, for instance, fuzzy sets,[32] fuzzy logic[33] and possibility theory[34] are alternatives to probability to model uncertainty. They argue that probability is insufficient or inconvenient to model certain aspects of incomplete/uncertain knowledge.

The defense of probability is mainly based on Cox's theorem, which starts from four postulates concerning rational reasoning in the presence of uncertainty. It demonstrates that the only mathematical framework that satisfies these postulates is probability theory. The argument is that any approach other than probability necessarily infringes one of these postulates and the value of that infringement.

Probabilistic programming

The purpose of probabilistic programming is to unify the scope of classical programming languages with probabilistic modeling (especially bayesian networks) to deal with uncertainty while profiting from the programming languages' expressiveness to encode complexity.

Extended classical programming languages include logical languages as proposed in Probabilistic Horn Abduction,[35] Independent Choice Logic,[36] PRISM,[37] and ProbLog which proposes an extension of Prolog.

It can also be extensions of functional programming languages (essentially Lisp and Scheme) such as IBAL or CHURCH. The underlying programming languages can be object-oriented as in BLOG and FACTORIE or more standard ones as in CES and FIGARO.[38]

The purpose of Bayesian programming is different. Jaynes' precept of "probability as logic" argues that probability is an extension of and an alternative to logic above which a complete theory of rationality, computation and programming can be rebuilt.[1] Bayesian programming attempts to replace classical languages with a programming approach based on probability that considers incompleteness and uncertainty.

The precise comparison between the semantics and power of expression of Bayesian and probabilistic programming is an open question.

See also

References

  1. 1.0 1.1 Jaynes, E. T. (10 April 2003). Probability Theory: The Logic of Science. Cambridge University Press. ISBN 978-1-139-43516-1. https://books.google.com/books?id=UjsgAwAAQBAJ. 
  2. Bessiere, Pierre; Mazer, Emmanuel; Manuel Ahuactzin, Juan; Mekhnacha, Kamel (20 December 2013). Bayesian Programming. CRC Press. ISBN 978-1-4398-8032-6. https://books.google.com/books?id=4XtcAgAAQBAJ. 
  3. "Expression Graphs: Unifying Factor Graphs and Sum-Product Networks". http://bcf.usc.edu/~rosenblo/Pubs/agi15_demski.pdf. 
  4. "Probabilistic Modeling and Bayesian Analysis". https://ocw.mit.edu/courses/sloan-school-of-management/15-097-prediction-machine-learning-and-statistics-spring-2012/lecture-notes/MIT15_097S12_lec15.pdf. 
  5. "Bayesian Networks". http://www.cs.brandeis.edu/~cs134/K_F_Ch3.pdf. 
  6. Kalman, R. E. (1960). "A New Approach to Linear Filtering and Prediction Problems". Journal of Basic Engineering 82: 33–45. doi:10.1115/1.3662552. 
  7. Bessière, Pierre; Laugier, Christian; Siegwart, Roland (15 May 2008). Probabilistic Reasoning and Decision Making in Sensory-Motor Systems. Springer Science & Business Media. ISBN 978-3-540-79006-8. https://books.google.com/books?id=Rk6ZnpmfhrQC. 
  8. Lebeltel, O.; Bessière, P.; Diard, J.; Mazer, E. (2004). "Bayesian Robot Programming". Advanced Robotics 16 (1): 49–79. doi:10.1023/b:auro.0000008671.38949.43. http://cogprints.org/1670/5/Lebeltel2000.pdf. 
  9. Diard, J.; Gilet, E.; Simonin, E.; Bessière, P. (2010). "Incremental learning of Bayesian sensorimotor models: from low-level behaviours to large-scale structure of the environment". Connection Science 22 (4): 291–312. doi:10.1080/09540091003682561. Bibcode2010ConSc..22..291D. https://hal.archives-ouvertes.fr/hal-00537809/file/diard10_author.pdf. 
  10. Pradalier, C.; Hermosillo, J.; Koike, C.; Braillon, C.; Bessière, P.; Laugier, C. (2005). "The CyCab: a car-like robot navigating autonomously and safely among pedestrians". Robotics and Autonomous Systems 50 (1): 51–68. doi:10.1016/j.robot.2004.10.002. 
  11. Ferreira, J.; Lobo, J.; Bessière, P.; Castelo-Branco, M.; Dias, J. (2012). "A Bayesian Framework for Active Artificial Perception". IEEE Transactions on Systems, Man, and Cybernetics - Part B: Cybernetics 99 (2): 1–13. doi:10.1109/TSMCB.2012.2214477. PMID 23014760. https://hal.archives-ouvertes.fr/hal-00747148/file/A_Bayesian_Framework_for_Active_Artificial_Perception.pdf. 
  12. Ferreira, J. F.; Dias, J. M. (2014). Probabilistic Approaches to Robotic Perception. Springer. ISBN 978-3-319-02005-1. 
  13. Mekhnacha, K.; Mazer, E.; Bessière, P. (2001). "The design and implementation of a Bayesian CAD modeler for robotic applications". Advanced Robotics 15 (1): 45–69. doi:10.1163/156855301750095578. 
  14. Coué, C.; Pradalier, C.; Laugier, C.; Fraichard, T.; Bessière, P. (2006). "Bayesian Occupancy Filtering for Multitarget Tracking: an Automotive Application". International Journal of Robotics Research 25 (1): 19–30. doi:10.1177/0278364906061158. https://hal.inria.fr/inria-00182004/file/coue-etal-ijrr-06.pdf. 
  15. Vasudevan, S.; Siegwart, R. (2008). "Bayesian space conceptualization and place classification for semantic maps in mobile robotics". Robotics and Autonomous Systems 56 (6): 522–537. doi:10.1016/j.robot.2008.03.005. 
  16. Perrin, X.; Chavarriaga, R.; Colas, F.; Seigwart, R.; Millan, J. (2010). "Brain-coupled interaction for semi-autonomous navigation of an assistive robot". Robotics and Autonomous Systems 58 (12): 1246–1255. doi:10.1016/j.robot.2010.05.010. http://infoscience.epfl.ch/record/149091. 
  17. Rett, J.; Dias, J.; Ahuactzin, J-M. (2010). "Bayesian reasoning for Laban Movement Analysis used in human-machine interaction". International Journal of Reasoning-Based Intelligent Systems 2 (1): 13–35. doi:10.1504/IJRIS.2010.029812. 
  18. Möbus, C.; Eilers, M.; Garbe, H.; Zilinski, M. (2009), "Probabilistic and Empirical Grounded Modeling of Agents in (Partial) Cooperative Traffic Scenarios", in Duffy, Vincent G., Digital Human Modeling, Lecture Notes in Computer Science, Volume 5620, 5620, Second International Conference, ICDHM 2009, San Diego, CA, USA: Springer, pp. 423–432, doi:10.1007/978-3-642-02809-0_45, ISBN 978-3-642-02808-3, http://oops.uni-oldenburg.de/1844/1/PartialCooperative20090223_PCM.pdf 
  19. Möbus, C.; Eilers, M. (2009), "Further Steps Towards Driver Modeling according to the Bayesian Programming Approach", in Duffy, Vincent G., Digital Human Modeling, Lecture Notes in Computer Science, Volume 5620, 5620, Second International Conference, ICDHM 2009, San Diego, CA, USA: Springer, pp. 413–422, doi:10.1007/978-3-642-02809-0_44, ISBN 978-3-642-02808-3 
  20. Eilers, M.; Möbus, C. (2010). "Lernen eines modularen Bayesian Autonomous Driver Mixture-of-Behaviors (BAD MoB) Modells". in Kolrep, H.; Jürgensohn, Th.. Düsseldorf, Germany: VDI-Verlag. pp. 61–74. ISBN 978-3-18-303222-8. http://www.lks.uni-oldenburg.de/download/Publikationen/2010/Eilers&PCM2010_BFFM_BAD_MoB_Modells2010.pdf. 
  21. Eilers, M.; Möbus, C. (2011). "Learning the Relevant Percepts of Modular Hierarchical Bayesian Driver Models Using a Bayesian Information Criterion". in Duffy, V.G.. Heidelberg, Germany: Springer. pp. 463–472. doi:10.1007/978-3-642-21799-9_52. ISBN 978-3-642-21798-2. 
  22. Eilers, M.; Möbus, C. (2011). "Learning of a Bayesian Autonomous Driver Mixture-of-Behaviors (BAD-MoB) Model". in Duffy, V.G.. Boca Raton, USA: CRC Press, Taylor & Francis Group. pp. 436–445. ISBN 978-1-4398-3511-1. http://www.crcpress.com/product/isbn/9781439835111. 
  23. Le Hy, R.; Arrigoni, A.; Bessière, P.; Lebetel, O. (2004). "Teaching Bayesian Behaviours to Video Game Characters". Robotics and Autonomous Systems 47 (2–3): 177–185. doi:10.1016/j.robot.2004.03.012. http://cogprints.org/3744/1/lehy04.pdf. 
  24. Synnaeve, G. (2012). Bayesian Programming and Learning for Multiplayer Video Games. http://tel.archives-ouvertes.fr/docs/00/78/06/35/PDF/29588_SYNNAEVE_2012_archivage.pdf. 
  25. Colas, F.; Droulez, J.; Wexler, M.; Bessière, P. (2008). "A unified probabilistic model of the perception of three-dimensional structure from optic flow". Biological Cybernetics 97 (5–6): 461–77. doi:10.1007/s00422-007-0183-z. PMID 17987312. 
  26. Laurens, J.; Droulez, J. (2007). "Bayesian processing of vestibular information". Biological Cybernetics 96 (4): 389–404. doi:10.1007/s00422-006-0133-1. PMID 17146661. 
  27. Colas, F.; Flacher, F.; Tanner, T.; Bessière, P.; Girard, B. (2009). "Bayesian models of eye movement selection with retinotopic maps". Biological Cybernetics 100 (3): 203–214. doi:10.1007/s00422-009-0292-y. PMID 19212780. https://hal.archives-ouvertes.fr/hal-00384515/file/main.pdf. 
  28. Serkhane, J.; Schwartz, J-L.; Bessière, P. (2005). "Building a talking baby robot A contribution to the study of speech acquisition and evolution". Interaction Studies 6 (2): 253–286. doi:10.1075/is.6.2.06ser. https://hal.archives-ouvertes.fr/hal-00186575/file/Serkhane_Interaction_Studies_2005.pdf. 
  29. Moulin-Frier, C.; Laurent, R.; Bessière, P.; Schwartz, J-L.; Diard, J. (2012). "Adverse conditions improve distinguishability of auditory, motor and percep-tuo-motor theories of speech perception: an exploratory Bayesian modeling study". Language and Cognitive Processes 27 (7–8): 1240–1263. doi:10.1080/01690965.2011.645313. https://hal.archives-ouvertes.fr/hal-01059179/file/moulin-frier12.pdf. 
  30. Gilet, E.; Diard, J.; Bessière, P. (2011). Sporns, Olaf. ed. "Bayesian Action–Perception Computational Model: Interaction of Production and Recognition of Cursive Letters". PLOS ONE 6 (6): e20387. doi:10.1371/journal.pone.0020387. PMID 21674043. Bibcode2011PLoSO...620387G. 
  31. "New algorithm helps machines learn as quickly as humans". 2016-01-22. http://www.gizmag.com/artificial-intelligence-algorithm-learning/41448. 
  32. Template:Cite q
  33. Template:Cite q
  34. Dubois, D.; Prade, H. (2001). "Possibility Theory, Probability Theory and Multiple-Valued Logics: A Clarification". Ann. Math. Artif. Intell. 32 (1–4): 35–66. doi:10.1023/A:1016740830286. ftp://ftp.irit.fr/IRIT/ADRIA/AMAI-Dub.Pra.revised.pdf. 
  35. Poole, D. (1993). "Probabilistic Horn abduction and Bayesian networks". Artificial Intelligence 64: 81–129. doi:10.1016/0004-3702(93)90061-F. 
  36. Poole, D. (1997). "The Independent Choice Logic for modelling multiple agents under uncertainty". Artificial Intelligence 94 (1–2): 7–56. doi:10.1016/S0004-3702(97)00027-1. 
  37. Sato, T.; Kameya, Y. (2001). "Parameter learning of logic programs for symbolic-statistical modeling". Journal of Artificial Intelligence Research 15 (2001): 391–454. doi:10.1613/jair.912. Bibcode2011arXiv1106.1797S. http://www.jair.org/media/912/live-912-2013-jair.pdf. Retrieved 2015-10-18. 
  38. on GitHub

Further reading

External links