Mathematics for active inference

Spaces, outcomes, and events

Sample space \(\Omega\): The set of possible elementary outcomes in a probability model.

Outcome \(\omega\): One element of the sample space, \(\omega \in \Omega\).

Measurable set: A set of outcomes or values (see below) to which the model’s probability measure assigns a probability. It does not imply that the probability is known, computable, or experimentally measurable.

Event \(A\): A measurable set of outcomes from the sample space. An event occurs when the realized outcome belongs to that subset.

Probability \(P(A)\): A number in \([0,1]\) assigned to an event \(A\)—a measurable set of outcomes—quantifying how likely an outcome is to belong to \(A\). The assignment \(P\) is called a probability measure. It satisfies \(P(\Omega)=1\) and countable additivity: for any countable collection of mutually exclusive events \(A_1,A_2,\ldots\),

\[
P\left(\cup_i A_i\right)=\sum_i P(A_i).
\]

Thus \(P\) is a function defined on events, while \(P(A)\) is the probability assigned to one particular event.

State space \(\mathcal X\): The set in which the values of a quantity lie, equipped with a suitable measurable structure. It may consist of categories, numbers, vectors, or more general objects. It need not have coordinates or a notion of dimension.

Cartesian product \(\mathcal X \times \mathcal Y\): The set of all ordered pairs \((x,y)\) with \(x \in \mathcal X\) and \(y \in \mathcal Y\). It provides a state space for a pair of quantities. Forming this product does not assume that the quantities are independent.

The distinction between sample space and state space concerns their roles in the model. It is not a distinction between an unobservable world and observable measurements: state spaces can also describe hidden states.

Difference between an outcome and an event

For a combined coin toss and a die roll, we can take

\[
\Omega={\mathrm H,\mathrm T}\times{1,2,3,4,5,6}.
\]

One elementary outcome is \(\omega=(\mathrm H,3)\). The event “the coin shows heads” is the set

\[
A={(\mathrm H,1),\ldots,(\mathrm H,6)}.
\]

For a fair coin and an independent fair die we have the probabilities,

\[
P({(\mathrm H,3)})=\frac1{12},
\qquad
P(A)=\frac12.
\]

An individual outcome and an event containing several outcomes are different objects.

Random elements, random variables, and values

Measurable function: The state space also has designated measurable subsets. A measurable function \(X:\Omega\to\mathcal X\) is measurable if, for every measurable subset \(B \subseteq \mathcal X\), its preimage

\[
X^{-1}(B)
=
\{\omega\in\Omega\mid X(\omega)\in B\}
\]

is a measurable subset of \(\Omega\).

This set collects all outcomes that \(X\) maps into \(B\). The notation does not require \(X\) to have an inverse function.

Measurability ensures that \(P\) can assign a probability to this set of outcomes and thereby determine the probability that \(X\)’s value belongs to \(B\).

The mapping \(X\) is fixed. The probability measure \(P\) on the sample space induces a probability distribution over the possible values of \(X\):

\[
P(X\in B)=P\bigl(X^{-1}(B)\bigr).
\]

Random element \(X\): A measurable function

\[
X:\Omega\to\mathcal X.
\]

Random variable \(X\): A real-valued random element. A vector-valued random element is called a random vector. Other texts sometimes use “random variable” more broadly, including for categorical quantities.

Value \(x\): An element of \(\mathcal X\). When a particular outcome \(\omega\) is realized, the corresponding realized value is

\[
x=X(\omega).
\]

A lowercase symbol can also denote a candidate value or a variable of summation or integration. It does not necessarily denote an observation that has already occurred.

We use capital letters for random elements and lowercase letters for their values. Thus \(X\) denotes the function, whereas \(x = X(\omega)\) denotes its value at a particular outcome.

Random element examples

In the coin-and-die model, define

\[
X(c,d)=c,\qquad Y(c,d)=d.
\]

Here \(X\) is a categorical random element and \(Y\) is a real-valued random variable. For \(\omega=(\mathrm H,3)\),

\[
X(\omega)=\mathrm H,\qquad Y(\omega)=3.
\]

If a numerical representation of the coin result is useful, define another random variable,

\[
Z=\mathbf 1_{\{X=\mathrm H\}},
\]

which equals \(1\) for heads and \(0\) for tails. This coding allows numerical operations such as taking a mean. Probabilities and entropy of the categorical distribution do not require numerical coding.

For a uniformly distributed number between \(0\) and \(1\), we can take \(\Omega=[0,1]\), assign interval probabilities by their lengths, and define

\[
X(\omega)=\omega.
\]

Here the sample space and state space are the same set, and \(X\) is the identity function.

Distributions, probability masses, and densities

Distribution of X \(P_X\): If \(B\) is measurable, we can define a probability distribution on \(\mathcal X\):

\[
P_X(B)=P(X\in B)
=P\bigl({\omega \in \Omega \mid X(\omega) \in B}\bigr).
\]

In particular,

\[
P(X=x)
=
P\bigl(\{\omega\in\Omega\mid X(\omega)=x\}\bigr).
\]

Several elementary outcomes may map to the same value \(x\).

Although we write probabilities involving random variables, \(P\) still acts on events. The expression \(X=x\) specifies an event; it is not the random variable \(X\) itself.

We seldom use the concept of a distribution. Instead we represent probability distributions by their mass functions in discrete cases and density functions in continuous cases, denoting either by \(q_X\). Here \(q_X\) denotes the entire function, while \(q_X(x)\) denotes its value at \(x\). Probabilities of sets are obtained by summing or integrating this function.

Probability mass function \(p_X\): A function that assigns a probability to each individual value in a measurable state space:

\[
p_X(x)=P_X(\{x\})=P(X=x)
\]

Probabilities of sets are obtained by summing:

\[ P_X(B)=\sum_{x\in B}p_X(x), \qquad
\sum_{x\in\mathcal X}p_X(x)=1. \]

Probability density function \(p_X\): A nonnegative function that represents probabilities through integration. It is the continuous version of a probability mass function.

\[
P_X(B)=\int_B p_X(x),dx,
\qquad
\int_{\mathbb R}p_X(x) dx=1.
\]

Here \(p_X(x)\) is a density value, not the probability of the point \(x\). In particular, \(P(X=x)=0\) for every individual \(x\), even where \(p_X(x)>0\).

Discrete example

For a fair die,

\[
p_Y(3)=P(Y=3)=\frac16.
\]

Continuous example

For \(X\) uniform on \([0,1]\),

\[
p_X(x)=1\quad\text{for }0\leq x\leq1,
\]

and zero outside that interval. Consequently,

\[
P(0.2\leq X\leq0.4)=\int_{0.2}^{0.4}1 dx=0.2,
\qquad
P(X=0.3)=0.
\]

We distinguish three objects:

NotationObject
\(P_X\)The probability distribution: a measure assigning probabilities to sets
\(p_X(\cdot) = p_X\)The probability mass function or probability density function. The notation with a dot argument is optional.
\(p_X(x)\)The value of the probability mass or density function evaluated at a specified value \(x\)

The dot marks an argument that remains open. Although a mass function or density represents a distribution, it is a different kind of mathematical object from the measure itself.

For brevity, we will also use “distribution” to refer to a probability mass or density function when the distinction between the probability law and its functional representation is not important.

Joint and conditional distributions

The pair \((Y,X)\) is a random element taking values in \(\mathcal{Y}\times\mathcal{X}\).

In the discrete case, its joint probability of \((Y,X)\) is given by the probability mass function (\p_{Y,X}\):

\[
p_{Y,X}(y,x)=P(Y=y,X=x).
\]

For \(p_X(x)>0\), the conditional probability for \(y\) for a given \(x\) is defined by the conditional probability mass function \(p_{Y\mid X}\):

\[
p_{Y\mid X}(y\mid x)
=
P(Y=y\mid X=x)
=
\frac{p_{Y,X}(y,x)}{p_X(x)}.
\]

Holding the given \(x\) fixed and summing over \(y\) gives

\[
\sum_y p_{Y\mid X}(y\mid x)=1.
\]

When the pair has a joint probability density, the conditional density is given by the conditional probability density function \(p_{Y\mid X}\):

\[
p_{Y\mid X}(y\mid x)
=
\frac{p_{Y,X}(y,x)}{p_X(x)},
\qquad
p_X(x)>0.
\]

Holding \(x\) fixed and integrating over \(y\) gives

\[
\int p_{Y\mid X}(y\mid x)\,dy=1.
\]

This is a ratio of densities; it is not a ratio of point probabilities, which are zero in this case. Probabilities are obtained by integration:

\[
P(Y\in B\mid X=x)
=
\int_B p_{Y\mid X}(y\mid x)\,dy.
\]

In either case, the denominator normalizes the mass or density function obtained for the specified value of \(X\).

Conditioning on a value or on a random element

The distinction between \(x\) and \(X\) becomes especially useful here:

ExpressionMeaning
\(p_{Y\mid X}(y\mid x)\)A scalar mass or density value, with both \(y\) and \(x\) specified
\(p_{Y\mid X}(\cdot\mid x)\)An entire conditional mass or density function, with \(x\) specified
\(p_{Y\mid X}(y\mid X)\)A scalar random variable, with \(y\) specified and \(X\) random
\(p_{Y\mid X}(\cdot\mid X)\)A random element whose values are entire conditional mass or density functions

For fixed \(y\), the third expression means the composition

\[
\omega\longmapsto p_{Y\mid X}(y\mid X(\omega)).
\]

The fourth expression means

\[
\omega\longmapsto p_{Y\mid X}(\cdot\mid X(\omega)).
\]

Each outcome selects one conditional function. The corresponding conditional probability measure is defined on measurable sets \(B\) by

\[
P_{Y\mid X}(B\mid x)=P(Y\in B\mid X=x).
\]

Replacing \(x\) with \(X\) gives the random probability measure \(P_{Y\mid X}(\cdot\mid X)\). Here the open argument is a set \(B\), whereas the open argument of a mass or density function is a value \(y\).

Discrete example

Let a hidden state \(S\) take values \(a\) or \(b\), and let an observation \(O\) take values \(0\) or \(1\). Suppose

\[
p_{O\mid S}(1\mid a)=0.1,
\qquad
p_{O\mid S}(1\mid b)=0.8.
\]

Then \(p_{O\mid S}(1\mid S)\) takes the scalar value \(0.1\) or \(0.8\), depending on \(S\).

The expression \(p_{O\mid S}(\cdot\mid S)\) takes one of two complete probability mass functions. Listed in the order \(o=0,1\), these are

\[
(0.9,0.1)
\quad\text{or}\quad
(0.2,0.8).
\]

Continuous example

Suppose

\[
Y=X+\varepsilon,
\qquad
\varepsilon\sim\mathcal{N}(0,\sigma^2),
\]

with \(\varepsilon\) independent of \(X\) and \(\sigma>0\). Then

\[
p_{Y\mid X}(y\mid x)
=
\frac{1}{\sqrt{2\pi}\sigma}
\exp\left(-\frac{(y-x)^2}{2\sigma^2}\right).
\]

For a fixed \(y_0\), \(p_{Y\mid X}(y_0\mid X)\) is a random scalar: the height of the conditional density at \(y_0\).

The expression \(p_{Y\mid X}(\cdot\mid X)\) denotes the entire Gaussian density with random mean \(X\) and fixed variance \(\sigma^2\). Once \(X=x\), it becomes the particular density \(p_{Y\mid X}(\cdot\mid x)\).

The expectation operator

The expectation operator \(\mathbb{E}[\cdot]\) computes a probability-weighted average. For a measurable real-valued function \(f\) of a random element \(X\),

\[
\mathbb{E}_{P_X}[f(X)]
=
\int_\Omega f(X(\omega))\,P(d\omega)
=
\int_{\mathcal{X}}f(x)\,P_X(dx),
\]

provided the expectation is defined. The subscript \(P_X\) denotes the distribution that specifies how \(X\) is weighted. It can be helpful to think of the averaging operation as an averaging over many samples of \(X\) from the distribution \(P_X\). The distribution \(P_X\) may in turn be specified by a probability mass function or a probability density function \(p_X\).

The notation \(P(d\omega)\) means integration with respect to the probability measure \(P\). Likewise, \(P_X(dx)\) means integration with respect to the distribution of \(X\).

Instead of specifying the probability weighting with a distribution, we specify it explictly with the probability density function or probability mass function that is associated with the distribution.

For a discrete distribution, this becomes

\[
\mathbb{E}_{p_X}[f(X)]
=
\sum_{x\in\mathcal{X}}f(x)p_X(x).
\]

For a real-valued \(X\) with a density, it becomes

\[
\mathbb{E}_{p_X}[f(X)]
=
\int_{\mathbb{R}}f(x)p_X(x)\,dx.
\]

The left side uses the random quantity \(f(X)\). On the right, the lowercase \(x\) runs over possible values and is a bound variable of the sum or integral.

For a fair die,

\[
\mathbb{E}_{p_Y}[Y]
=
\sum_{y=1}^{6}y\,\frac{1}{6}
=
\frac{7}{2}.
\]

For \(X\) uniform on \([0,1]\),

\[
\mathbb{E}_{p_X}[X]
=
\int_0^1 x\,dx
=
\frac{1}{2}.
\]

When we want to make the random variable that varies during the averaging explicit, we write

\[
\mathbb{E}_{X\sim p_X}[f(X)],
\]

but more often we use the shorter form

\[
\mathbb{E}_{p_X}[f(X)],
\]

For the preceding discrete hidden-state example, if

\[
q_S(a)=0.6,
\qquad
q_S(b)=0.4,
\]

then

\[
\mathbb{E}_{q_S}
\left[p_{O \mid S}(1 \mid S)\right]
=
0.6(0.1)+0.4(0.8)
=
0.38.
\]

This expectation averages conditional probabilities, each of which is a scalar.

Entropy and explicit notation in active inference

Entropy is a functional: it takes an entire probability mass or density function as its argument and returns a scalar, when defined. We use square brackets for its function argument.

For a discrete observation distribution,

\[
H[p_O]
=
-\sum_o p_O(o)\ln p_O(o),
\]

with the convention \(0\ln0=0\).

For a continuous observation with a density, the corresponding quantity is differential entropy:

\[
h[p_O]
=
-\int p_O(o)\ln p_O(o)\,do.
\]

We distinguish \(H\) from \(h\) because discrete entropy and differential entropy have different properties. In particular, differential entropy can be negative and depends on the coordinates and units used. Natural logarithms give information quantities in nats.

Expected conditional entropy

This is where adherence to a strict ontology becomes helpful. For discrete states and observations, we write

\[
\mathbb{E}_{S\sim q_S}
\left[
H\left[p_{O\mid S}(\cdot\mid S)\right]
\right]
=
\sum_s q_S(s)
\left[
-\sum_o p_{O\mid S}(o\mid s)
\ln p_{O\mid S}(o\mid s)
\right].
\]

The composition is explicit:

  1. \(S\) is a random state.
  2. \(p_{O\mid S}(\cdot\mid S)\) is a random probability mass function.
  3. Applying \(H\) produces a scalar random variable.
  4. Taking its expectation produces a scalar.

For continuous states and observations with suitable densities, the analogous expression uses differential entropy:

\[
\mathbb{E}_{S\sim q_S}
\left[
h\left[p_{O\mid S}(\cdot\mid S)\right]
\right]
=
\int q_S(s)
\left[
-\int p_{O\mid S}(o\mid s)
\ln p_{O\mid S}(o\mid s)\,do
\right]ds.
\]

Discrete and continuous quantities can also be combined: use a sum for each discrete quantity and an integral for each continuous one. The likelihood must be specified wherever the averaging distribution requires it, and the expectations must be defined.

The compact notation

\[
\mathbb{E}_{q(s)}
\left[H[p(o\mid s)]\right]
\]

is conventionally understood in this way for discrete observations. Our expanded notation makes explicit that entropy receives an entire conditional probability mass function, while the outer expectation averages the resulting scalar over states.

Expected log likelihood

For a fixed observed value \(o\), we write

\[
\mathbb{E}_{S\sim q_S}
\left[
\ln p_{O\mid S}(o\mid S)
\right].
\]

Here \(o\) remains fixed. The expression inside the brackets is a scalar random quantity because it depends on \(S\).

For discrete states,

\[
\mathbb{E}_{S\sim q_S}
\left[
\ln p_{O\mid S}(o\mid S)
\right]
=
\sum_s q_S(s)\ln p_{O\mid S}(o\mid s).
\]

For continuous states with density \(q_S\),

\[
\mathbb{E}_{S\sim q_S}
\left[
\ln p_{O\mid S}(o\mid S)
\right]
=
\int q_S(s)\ln p_{O\mid S}(o\mid s)\,ds.
\]

The familiar expression \(\mathbb{E}_{q(s)}[\ln p(o\mid s)]\) is a compact way to write the same averaging operation. We choose the expanded form to distinguish the fixed observation \(o\), the random state \(S\), and the integration or summation variable \(s\).

Covariance

Covariance describes how two quantities vary together relative to their respective means. A covariance matrix collects the variances and pairwise covariances of the components of a random vector.

Throughout this section, all required second moments are finite. The subscript on an expectation or covariance specifies the distribution used for averaging. The expression \(S\sim q_S\) means that \(S\) has the mass or density function \(q_S\); it does not require an actual sampling operation.

Covariance of two scalar random variables

Let \(S\) and \(T\) have joint mass or density function \(q_{S,T}\), with marginal functions \(q_S\) and \(q_T\). Define their means:

\[ \mu_S=\mathbb{E}_{S\sim q_S}[S], \qquad \mu_T=\mathbb{E}_{T\sim q_T}[T]. \]

Their covariance is

\[ \operatorname{Cov}_{(S,T)\sim q_{S,T}}[S,T] = \mathbb{E}_{(S,T)\sim q_{S,T}} \left[(S-\mu_S)(T-\mu_T)\right]. \]

The product is positive when the two deviations have the same sign and negative when they have opposite signs. Covariance averages these products. Zero covariance does not, in general, imply independence.

For discrete variables,

\[ \operatorname{Cov}_{(S,T)\sim q_{S,T}}[S,T] = \sum_s\sum_t (s-\mu_S)(t-\mu_T)q_{S,T}(s,t). \]

For variables with a joint density,

\[ \operatorname{Cov}_{(S,T)\sim q_{S,T}}[S,T] = \iint (s-\mu_S)(t-\mu_T)q_{S,T}(s,t)\,ds\,dt. \]

The covariance of a scalar random variable with itself is its variance:

\[ \operatorname{Var}_{S\sim q_S}[S] = \mathbb{E}_{S\sim q_S}\left[(S-\mu_S)^2\right]. \]

Covariance of a random vector

Let \(M\) be a column random vector, with mass or density function \(q_M\), and define its mean vector:

\[ \mu_M=\mathbb{E}_{M\sim q_M}[M]. \]

Its covariance matrix is

\[ \Sigma_M := \operatorname{Cov}_{M\sim q_M}[M] = \mathbb{E}_{M\sim q_M} \left[(M-\mu_M)(M-\mu_M)^T\right]. \]

The superscript \(T\) denotes transpose. Multiplying a column vector by a row vector produces an outer product. For example,

\[ \begin{pmatrix}u_1\\u_2\end{pmatrix} \begin{pmatrix}v_1&v_2\end{pmatrix} = \begin{pmatrix} u_1v_1&u_1v_2\\ u_2v_1&u_2v_2 \end{pmatrix}. \]

Expectations of vectors and matrices are calculated component by component. Thus,

\[ (\Sigma_M)_{ij} = \mathbb{E}_{M\sim q_M} \left[(M_i-\mu_{M,i})(M_j-\mu_{M,j})\right]. \]

The diagonal entries are component variances. The off-diagonal entries are covariances between different components. The matrix is symmetric.

For a discrete random vector,

\[ \Sigma_M = \sum_m (m-\mu_M)(m-\mu_M)^Tq_M(m). \]

For a random vector with a density,

\[ \Sigma_M = \int (m-\mu_M)(m-\mu_M)^Tq_M(m)\,dm. \]

Here \(dm\) denotes integration over all components of \(m\).

The same definition applies to a vector-valued function \(f(S)\). Writing \(\operatorname{Cov}_{S\sim q_S}[f(S)]\) means that we calculate the covariance of \(f(S)\) while averaging over \(S\). Its mean is \(\mathbb{E}_{S\sim q_S}[f(S)]\).

Discrete example

Let \(S\) and \(N\) be independent binary random variables, each equally likely to be \(0\) or \(1\), and define \(T=S+N\). Their joint mass function is:

\(s\)\(t\)\(q_{S,T}(s,t)\)
\(0\)\(0\)\(1/4\)
\(0\)\(1\)\(1/4\)
\(1\)\(1\)\(1/4\)
\(1\)\(2\)\(1/4\)

All other pairs have probability zero. The means are

\[ \mu_S=\frac{1}{2}, \qquad \mu_T=1. \]

The covariance is

\[ \begin{aligned} \operatorname{Cov}_{(S,T)\sim q_{S,T}}[S,T] &= \frac{1}{4} \left[ \left(-\frac{1}{2}\right)(-1) + \left(-\frac{1}{2}\right)(0) + \left(\frac{1}{2}\right)(0) + \left(\frac{1}{2}\right)(1) \right]\\ &=\frac{1}{4}. \end{aligned} \]

The variances are

\[ \operatorname{Var}_{S\sim q_S}[S]=\frac{1}{4}, \qquad \operatorname{Var}_{T\sim q_T}[T]=\frac{1}{2}. \]

Consequently, for the random vector \(M=(S,T)^T\),

\[ \mu_M= \begin{pmatrix} 1/2\\ 1 \end{pmatrix}, \qquad \Sigma_M= \begin{pmatrix} 1/4&1/4\\ 1/4&1/2 \end{pmatrix}. \]

Continuous example

Now let \(S\) and \(N\) be independent and uniformly distributed on \([0,1]\), again with \(T=S+N\). The joint density is

\[ q_{S,T}(s,t) = \begin{cases} 1, & 0\leq s\leq1\ \text{and}\ s\leq t\leq s+1,\\ 0, & \text{otherwise}. \end{cases} \]

The means are again \(\mu_S=1/2\) and \(\mu_T=1\). This time, covariance is calculated by integration:

\[ \begin{aligned} \operatorname{Cov}_{(S,T)\sim q_{S,T}}[S,T] &= \int_0^1 \int_s^{s+1} \left(s-\frac{1}{2}\right)(t-1)\,dt\,ds\\ &= \int_0^1 \left(s-\frac{1}{2}\right)^2\,ds\\ &=\frac{1}{12}. \end{aligned} \]

The component variances are

\[ \operatorname{Var}_{S\sim q_S}[S] = \int_0^1\left(s-\frac{1}{2}\right)^2\,ds = \frac{1}{12}, \]

and

\[ \operatorname{Var}_{T\sim q_T}[T] = \int_0^1\int_s^{s+1}(t-1)^2\,dt\,ds = \frac{1}{6}. \]

Thus, for \(M=(S,T)^T\),

\[ \Sigma_M= \begin{pmatrix} 1/12&1/12\\ 1/12&1/6 \end{pmatrix}. \]

Both examples use the same definition: average products of deviations from the mean. The discrete example uses probability masses and sums; the continuous example uses a density and integrals.

Kullback-Leibler divergence

Kullback-Leibler divergence is a core functional in active inference. It measures the dissimilarity between two distributions, here \(q_X\) and \(p_X\):

\[D_\mathrm{KL}\left[q_X \mid \mid p_X \right] = \mathbb{E}_{q_X}\left[\ln\frac{q_X (X)}{p_X(X)}\right] = \mathbb{E}_{q_X}\left[\ln q_X(X) – \ln p_X(X) \right] = \int q_X(x) (\ln q_X(x) – \ln p_X(x)) dx\]

For a discrete distribution, the integral is replaced with a sum.

The right distribution is often conditional in active inference:

\[d(y) := D_\mathrm{KL}\left[q_X \mid \mid p_{X \mid Y}(\cdot \mid y) \right]\]

Here \(X\mid Y\) in the subscript labels the conditional model; the argument \(y\) specifies which member of that model’s family of distributions we use. The dot indicates the argument over which that distribution varies.

For continuous \(X\), this means

\[d(y)=\int q_X(x)\ln\frac{q_X(x)}{p_{X\mid Y}(x\mid y)}\,dx. \]

For a discrete \(X\), the integral is replaced with a sum. For each fixed \(y\), \(d(y)\) is a scalar.

If we substitute the random variable \(Y\) for the fixed value \(y\) we get:

\[d(Y)=D_{\mathrm{KL}}\!\left[q_X\parallel p_{X\mid Y}(\cdot\mid Y)\right]. \]

Here \(d(Y)\) is a random variable: its value depends on \(Y\). It can therefore for instance be averaged:

\[\mathbb E_{q_Y}[d(Y)] = \mathbb E_{q_Y}\!\left[ D_{\mathrm{KL}}\!\left[ q_X\parallel p_{X\mid Y}(\cdot\mid Y) \right]\right] = \int_{\mathcal Y} q_Y(y) \left[ \int_{\mathcal X} q_X(x) \ln\frac{q_X(x)}{p_{X\mid Y}(x\mid y)} \,dx \right]dy.\]

In summary: \(d\) is a function, \(d(y)\) is its value at a fixed argument, and \(d(Y)\) is a random variable.

Monte Carlo integration

Integrals involving a distribution \(q_X\) can be approximated with the average of a limited number of “samples”:

\[\int_x f(x)q_X(x) dx := \mathbb E_{q_X} \left[f(x)\right] \approx \frac{1}{S}\sum_{j=1}^S f(x^{(j)})\]

with $latex x^{(j)}$ sampled from $latex q_X$. This approximation technique is called Monte Carlo integration and is used e.g., in deep learning implementations of free energy minimization.

Bayes’ theorem

For a discrete distribution we have:

$$p(s \mid o) = \frac{p(o, s)}{p(o)} = \frac{p(o \mid s)p(s)}{p(o)} = \frac{p(o \mid s)p(s)}{\sum_s p(o \mid s)p(s)}$$

In case of a continuous distribution we instead get:

$$p(s \mid o) = \frac{p(o \mid s)p(s)}{\int_s p(o \mid s)p(s) ds}$$

The Markov property and the observation model

The following derivation shows how the Markov property and the observation model makes it possible to simplify and therefore make tractable the joint distribution of observations and representational states \(p(s_{0:T} \mid o_{0:T})\).

The Markov property states that the current state only depends on the previous state.

The canonical observation model states that the observation only depends on the current state. This means that:

$$p(s_{0:T} \mid o_{0:T}) = p(o_T | s_{0:T}, o_{0:T-1}) \times p(s_{0:T}, o_{0:T-1})=$$

$$p(o_T | s_T)p(s_T \mid o_{0:T-1}, s_{0:T-1})p(o_{0:T-1}, s_{0:T-1})=$$

$$p(o_T | s_T)p(s_T \mid s_{T-1})p(o_{0:T-1}, s_{0:T-1})= \ldots$$

$$p(s_0) \prod_{t=0}^{T} p(o_t | s_t) \prod_{t=1}^{T} p(s_t | s_{t-1})$$

Mutual information

Mutual information measures the amount of shared information or mutual dependence between two random variables. It tells you how much knowing the value of one variable reduces uncertainty about the other.

\[I(X; Y) = D_{KL}\left[p_{X,Y} \parallel p_X p_Y \right].\]

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *