Skip to content

Commit 99033cb

Browse files
committed
docs: improve explanations in the background section
1 parent 5da73eb commit 99033cb

File tree

1 file changed

+43
-18
lines changed

1 file changed

+43
-18
lines changed

docs/src/background.md

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@
22

33
*TensorInference* implements efficient methods to perform Bayesian inference in
44
*probabilistic graphical models*, such as Bayesian Networks or Markov random
5-
fields.
5+
fields. This page introduces probabilistic graphical models, provides an example
6+
using a Bayesian network, and explains what probabilistic inference is,
7+
including the different tasks it can involve.
68

79
## Probabilistic graphical models
810

9-
Probabilistic graphical models (PGMs) capture the mathematical modeling of
10-
reasoning in the presence of uncertainty. Bayesian networks and Markov random
11-
fields are popular types of PGMs. Consider the following Bayesian network known
12-
as the *ASIA network* [^lauritzen1988local].
11+
A probabilistic graphical model (PGM) is a mathematical framework that uses
12+
graphs to compactly represent complex multivariate statistical distributions.
13+
They are used to reason in the presence of uncertainty. This reasoning process
14+
is known as *probabilistic inference* and will be defined and discussed in
15+
detail later on.
16+
17+
*Bayesian networks* and *Markov random fields* are popular types of PGMs. The
18+
following PGM is an example of a Bayesian network called the *ASIA network*. It
19+
was introduced by Lauritzen in 1988 [^lauritzen1988local].
1320

1421
```@eval
1522
using TikzPictures
@@ -71,27 +78,45 @@ save(SVG(joinpath(@__DIR__, "asia-bayesian-network")), tp)
7178
| ``X`` | Chest X-Ray is positive |
7279
| ``D`` | Patient has dyspnoea |
7380

74-
The ASIA network corresponds a simplified example from the context of medical
75-
diagnosis that describes the probabilistic relationships between different
76-
random variables corresponding to possible diseases, symptoms, risk factors and
77-
test results. It consists of a graph ``G = (\bm{V},\mathcal{E})`` and a
78-
probability distribution ``P(\bm{V})`` where ``G`` is a directed acyclic graph,
79-
``\bm{V}`` is the set of variables and ``\mathcal{E}`` is the set of edges
80-
connecting the variables. We assume all variables to be discrete. Each variable
81-
``V`` is quantified with a *conditional probability distribution* ``P(V \mid
82-
pa(V))`` where ``pa(V)`` are the parents of ``V``. These conditional probability
83-
distributions together with the graph ``G`` induce a *joint probability
84-
distribution* over ``P(\bm{V})``, given by
81+
This network represents a simplified example from the realm of medical
82+
diagnosis, illustrating the probabilistic relationships between various random
83+
variables that correspond to potential diseases, symptoms, risk factors, and
84+
test results. It comprises a graph ``G = (\bm{V},\mathcal{E})`` and a
85+
probability distribution ``P(\bm{V})``, where ``G`` is a directed acyclic graph,
86+
``\bm{V}`` represents the set of variables, and ``\mathcal{E}`` is the set of
87+
edges connecting these variables. We assume all variables are discrete. Each
88+
variable ``V`` is quantified by a *conditional probability distribution* (CPD)
89+
``P(V \mid pa(V))``, where ``pa(V)`` denotes the parent variables of `V.`
90+
Collectively, these conditional probability distributions, together with the
91+
graph G, induce a joint probability distribution over ``P(\bm{V})``, given by
8592

8693
```math
8794
P(\bm{V}) = \prod_{V\in\bm{V}} P(V \mid pa(V)).
8895
```
8996

97+
A *factor*, denoted as ``\phi_{\bm{V}}``, is defined over a set of variables
98+
``\bm{V}``. It's a function that maps each instantiation ``\bm{V} = \bm{v}`` to
99+
a non-negative number. It's important to note that a probability distribution is
100+
a specific case of a *factor*. The *product* of two *factors*, ``\phi_{\bm{X}}``
101+
and ``\phi_{\bm{Y}}``, is another *factor*, ``\phi_{\bm{Z}}``, where ``\bm{Z} =
102+
\bm{X} \cup \bm{Y}``, and ``\phi_{\bm{Z}}(\bm{z}) =
103+
\phi_{\bm{X}}(\bm{x})\phi_{\bm{Y}}(\bm{y})`` for the instantiations ``\bm{x}``
104+
and ``\bm{y}`` that align with the instantiation ``\bm{z}``. The
105+
*marginalization* of a *factor* ``\phi_{\bm{Y}}`` into ``\bm{X} \subseteq
106+
\bm{Y}`` results in a new *factor* ``\phi_{\bm{X}}``, where each
107+
``\phi_{\bm{X}}(\bm{x})`` is calculated by summing the values of
108+
``\phi_{\bm{Y}}(\bm{y})`` for all ``\bm{y}`` that are consistent with
109+
``\bm{x}``. **Importantly, factor marginalization and product operations form
110+
the fundamental basis for conducting probabilistic inference in PGMs.**
90111

91112
## The inference tasks
92113

114+
Probabilistic inference is the process of determining the probability
115+
distribution of a set of unknown variables, given the values of known variables
116+
in a PGM. It encompasses several tasks that will be explained next.
117+
93118
Each task is performed with respect to a graphical model, denoted as
94-
``\mathcal{M} = \{\bm{V}, \bm{D}, \bm{\phi}\}``, where:
119+
``G = \{\bm{V}, \bm{D}, \bm{\phi}\}``, where:
95120

96121
``\bm{V} = \{ V_1 , V_2 , \dots , V_N \}`` is the set of the model’s variables
97122

@@ -173,7 +198,7 @@ This task involves calculating the probability of the observed evidence, which
173198
can be useful for model comparison or anomaly detection. This involves summing
174199
the joint probability over all possible states of the unobserved variables in
175200
the model, given some observed variables. This is a fundamental task in Bayesian
176-
statistics and is often used as a stepping stone for other types of inference."
201+
statistics and is often used as a stepping stone for other types of inference.
177202

178203
### Marginal inference (MAR):
179204

0 commit comments

Comments
 (0)