# Bayesian programming versus Bayesian networks

At first, the Bayesian programming syntax presented in the book “Bayesian Programming” may seem less convenient than the graphical presentation of standard Bayesian network software. The absence of an evident human-machine interface is not an oversight but a choice. This choice was made for four main reasons:

• We think that graphical representations impose supplementary constraints which do not result from the rules of probability nor from the logic of the problem. For instance, the rules of probability allow us to specify a decomposition including a distribution with two or more variables on the left part of the conditioning mark as, for example, P (B ∧ C|A ∧ π). This is not possible in a Bayesian network graphical representation without introducing an intermediate variable. This limitation becomes even more bothersome as seen in Equation 16.1. The two variables B and C are defined with the same joint distribution P (B ∧ C|π), while D is conditionally dependent on B and E on C. P (B ∧ C|π) P (D|B ∧ π) P (E|C ∧ π) (16.1). This decomposition becomes really difficult to represent in a graphical way. Any Bayesian network can be represented in the Bayesian programming formalism, but the opposite is not true. Indeed, the graphical representation with the same power of expression as Bayesian programming is probabilistic factor graphs [Loeliger, 2004].
• The algebraic notation used in Bayesian programming is very convenient for expressing iteration or recurrences. This greatly simplifies the specification of models that include the same submodel duplicated several times, such as Bayesian filters or hidden Markov models where

specifies everything in a very compact and rigorous manner.

• Bayesian programming, using the subroutine call mechanism described in Chapter 9, offers a very simple way to build hierarchical complex probabilistic models built from simpler elementary bricks. Much simpler and rigorous than the attempt to do the same thing with graphical notation such as for instance the network fragment approach [Laskey and Mahoney, 1997] or the Object Oriented Bayesian Network (OOBN) [Koller and Pfeffer, 1997] to cite only the oldest ones.
• As shown in Chapter 14, the algebraic notation used by Bayesian pro- graming may be used to revisit the different inference algorithms with a simpler and more systematic point of view, demonstrating that all these