Paper deep dive
Probabilistic Circuits as Reasoning Machines in Artificial Intelligence (Part I)
Robert Peharz
Intelligence
Status: succeeded | Model: Gemma-4-26B-A4B | Prompt: intel-v1 | Confidence: 89%
Last extracted: 8/23/2026, 2:23:04 AM
Summary
This paper presents a habilitation thesis by Robert Peharz advocating for Probabilistic Circuits (PCs) as a tractable framework for reasoning and learning under uncertainty in Artificial Intelligence. It argues that while probability is the ideal core language for AI due to its connections with logic, information theory, and human cognition, general probabilistic inference is NP-hard. PCs address this by imposing structural constraints (decomposability, smoothness, determinism) that allow for exact, polynomial-time computation of various inference queries (marginals, conditionals, MPE) similar to the efficiency of neural networks. The thesis synthesizes foundational theory, Bayesian learning approaches, integration with deep learning, and connections to symbolic machine learning.
Entities (10)
Relation Signals (9)
Robert Peharz → authored → Probabilistic Circuits as Reasoning Machines in Artificial Intelligence (Part I)
confidence 99% · Probabilistic Circuits as Reasoning Machines in Artificial Intelligence (Part I) Robert Peharz
Probabilistic Circuits → isa → Tractable Framework
confidence 95% · studies probabilistic circuits (PCs) as a powerful and tractable framework for reasoning and learning under uncertainty
Probabilistic Circuits → solves → Probabilistic Inference
confidence 95% · PCs address these challenges through structural constraints that ensure exact computation of a wide range of inference queries in polynomial time
Probabilistic Inference → iscomputationallyhard → NP-hard
confidence 90% · probabilistic inference is NP-hard in almost all probabilistic models.
Probabilistic Circuits → integrateswith → Deep Learning
confidence 85% · scalable implementations and integration with deep learning
Probabilistic Circuits → usesstructuralconstraints → Decomposability
confidence 85% · 5.1.1 Decomposability and Smoothness
Probabilistic Circuits → usesstructuralconstraints → Smoothness
confidence 85% · 5.1.1 Decomposability and Smoothness
Arithmetic Circuits → istypeof →
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:This cumulative habilitation thesis studies probabilistic circuits (PCs) as a powerful and tractable framework for reasoning and learning under uncertainty in artificial intelligence (AI). It first advocates for probability as a core language for AI, emphasizing its connections to logic and information theory; the conceptual simplicity of probabilistic reasoning---based primarily on the sum and product rules; the parallels between probabilistic inference and human cognition; and the role of probability in optimal decision making. However, probability also faces significant computational challenges, as probabilistic inference is NP-hard in almost all probabilistic models. PCs address these challenges through structural constraints that ensure exact computation of a wide range of inference queries in polynomial time, such as marginals, conditionals, most probable explanations, expectations, and more advanced inference tasks. This thesis synthesizes a decade of research across foundations, algorithmic developments, and empirical validation of PCs. Key contributions highlighted in this work are foundational theory of PCs, Bayesian approaches for learning PCs, scalable implementations and integration with deep learning, hybrid models that combine PCs with intractable models, and connections with symbolic machine learning paradigms. This is the first part of my Habilitation Thesis. The second part is omitted, as it comprises the cumulative part of the thesis and has been published at various venues (see Chapter 5).
Tags
Links
- Source: https://arxiv.org/abs/2608.16565v1
- Canonical: https://arxiv.org/abs/2608.16565v1
Trouble viewing inline? Open PDF directly →
Full Text
188,885 characters extracted from source content.
Expand or collapse full text
Institute of Machine Learning and Neural Computation University of Technology Computer Science Probabilistic Circuits as Reasoning Machines in Artificial Intelligence (Part I) Robert Peharz Abstract This cumulative habilitation thesis studies probabilistic circuits (PCs) as a powerful and tractable framework for reasoning and learning under uncertainty in artificial intelligence (AI). It first advocates for probability as a core language for AI, emphasizing its connections to logic and information theory; the conceptual simplicity of probabilistic reasoning—based primarily on the sum and product rules; the parallels between probabilistic inference and human cognition; and the role of probability in optimal decision making. However, probability also faces significant computational challenges, as probabilistic inference is NP-hard in almost all probabilistic models. PCs address these challenges through structural constraints that ensure exact computation of a wide range of inference queries in polynomial time, such as marginals, conditionals, most probable explanations, expectations, and more advanced inference tasks. This thesis synthesizes a decade of research across foundations, algorithmic developments, and empirical validation of PCs. Key contributions highlighted in this work are foundational theory of PCs, Bayesian approaches for learning PCs, scalable implementations and integration with deep learning, hybrid models that combine PCs with intractable models, and connections with symbolic machine learning paradigms. Acknowledgements. The people who need to be mentioned foremost are my lovely family, who have patiently endured, sometimes enjoyed, and always supported my academic endeavours: Thank you, Elisabeth, Benjamin, Raffael, and Hannah. This thesis is about probabilistic circuits and tractable probabilistic models. We are a small but growing community, continuously striving to promote and inspire enthusiasm for our approach to AI and probabilistic modeling. It has been a fun ride, and I hope it continues to be for decades (and centuries) to come. It wouldn’t be such a great pleasure to work in such an exciting field without the right allies and peers, some of whom are (in alphabetical order): Cory Butz, Cassio de Campos, YooJung Choi, Alvaro Correia, Nicola Di Mauro, Floriana Esposito, Gennaro Gala, Hong Ge, Robert Gens, Zoubin Ghahramani, Kristian Kersting, Steven Lang, Thomas Liebig, Lorenzo Loconte, Alejandro Molina, Martin Mundt, Jhonatan Oliveira, Franz Pernkopf, Pascal Poupart, Erik Quaeghebeur, Carl Rasmussen, Xiaoting Shao, Karl Stelzner, Pranav Subramani, PingLiang Tan, Martin Trapp, Isabel Valera, Guy Van den Broeck, Fabrizio Ventola, Antonio Vergari, Thomas Wedenig, and Yang Yang. Furthermore, I would like to thank the Austrian Science Fund (FWF) for supporting my work in the context of the Cluster of Excellence “Bilateral AI” (10.55776/COE12). Contents I Probabilistic Reasoning and AI 1 Introduction 1.1 What is AI (roughly)? 1.2 The Role of Probability 1.3 Why Probabilistic Circuits? 2 Basic Probability Theory 2.1 Measurable Space 2.1.1 Events are Sets 2.2 Probability Space 2.2.1 Why Sigma-Algebras? 2.3 Interpretations of Probability 2.4 Fundamental Laws of Probability 2.4.1 Law of Total Probability (The Sum Rule) 2.4.2 Conditional Probability (The Product Rule) 2.4.3 Bayes’ Rule (The Rule of Inverse Probability) 2.4.4 (Conditional) Independence 2.5 Random Variables 2.5.1 Distribution of a Random Variable 2.5.2 Distribution Functions 2.5.3 Multivariate Random Variables and Joint Distributions 3 Probabilistic Inference 3.1 Marginalization (The Sum Rule) 3.2 Conditioning (The Product Rule) 3.3 The Chain Rule 3.4 Bayes Rule (Law of Inverse Probability) 3.5 (Conditional) Independence 3.6 Expectations 3.7 Most Probable Explanation 3.8 Decision Theory 4 State of The Art 5 Probabilistic Circuits 5.1 Basic Definitions of Probabilistic Circuits 5.1.1 Decomposability and Smoothness 5.1.2 PCs as Hierarchical Mixtures 5.2 Marginalization 5.3 Conditioning 5.4 Expectations and Covariances 5.5 Determinism and Most Probable Explanation 5.6 Further Structural Properties and Tractable Inferences 5.7 Overview of Contributions 5.7.1 Foundations and Theory of PCs 5.7.2 Bayesian Approaches with PCs 5.7.3 Deep Learning and PCs 5.7.4 Hybrid Models and Inference 5.7.5 PCs and Symbolic Models Part I Probabilistic Reasoning and AI Chapter 1 Introduction In the last one or two decades we have witnessed a remarkable explosion of the fields of artificial intelligence (AI) and machine learning (ML). As research fields, AI and ML have gained tremendous momentum, reflected by an about tenfold increase of papers submitted to leading conferences over the last 10 years. In the digital industries ML is widely applied, ranging from more “classic” applications—such as spam mail detection, optical character recognition, machine translation, computer vision, and recommender systems—to more recent creative applications fuelled by advances in generative modelling, as exemplified by diffusion-based models for images and the prominent ChatGPT system. More generally, AI and ML are perceived as integral parts of the so-called “fourth industrial revolution,” promising a massive acceleration in automation of cognitive tasks and a tight integration of the physical and digital worlds. 1.1 What is AI (roughly)? While being an active and trendy technology, it is hard to fully specify what AI actually is. According to “Artificial Intelligence: A Modern Approach”, the standard textbook by Russell and Norvig russel2010, we can organize AI into four categories, spanned by two dichotomies: “human-oriented vs. rational AI” and “thinking vs. acting”. Human-oriented AI strives to imitate abilities of human intelligence, while rational AI formalizes intelligence via some well-principled measure of performance. While there is overlap between the human-oriented and rational approaches to AI, one can think of rational AIs which are rather distinct from human intelligence, and, vice versa, rational approaches might be insufficient to explain or imitate human intelligence. Thus, it makes sense to distinct these two styles of AI. This thesis is located in the “rational AI” segment. The second dichotomy—“thinking vs. acting”—distinguishes more “internal” abilities such as reasoning and cognition from more “external” abilities such as acting in an environment and making good decisions. This distinction also makes sense, even though “acting” surely requires “thinking” to a certain extent. While defining AI in a precise way poses some challenges, we can attempt to specify some necessary features or desiderata which any AI system needs to display to a certain degree: • Knowledge Representation and Modelling. It is a save to assume that any AI needs to have the ability to store information. More generally, we might assume a certain level of structural organization of information—broadly denoted as knowledge representation—facilitating subsequent tasks of the AI system. Perhaps synonymously to knowledge representation we might also say that an intelligent system needs the ability to represent a model of the world in which it is embedded. In a generous interpretation, knowledge representation and models can take various forms, ranging from explicit and formal representations, such as axiomatic systems, to implicit ones such as information stored in neural network weights. • Reasoning. Additionally, an AI system will require the ability to reason, i.e., to do something with the information stored and process it into “new” insights. The reasoning machinery will in general depend on the type of knowledge representation. A classical example is propositional logic, which would represent knowledge as an axiomatic system together with known facts and use deductive reasoning to derive “new” facts. A classical illustration is the propositional knowledge base Socrates is human All humans are mortal And the use of the modus ponens to conclude that Socrates is mortal But also common (systems of) equations such as E=mc2E=mc^2 might be interpreted as a representation of knowledge—relating the three quantities E, m and c—and algebraic manipulation as a reasoning process allowing us, for example, to conclude that Em=c2E m=c^2. These two requirements, knowledge representation and reasoning, are arguably necessary features for any AI system. They are probably not sufficient, as they are also fulfilled on a small scale by rather simple systems such as pocket calculators, which are not commonly perceived as “intelligent.” However, some logic-based AI systems in the early area of AI would also be confined to these two aspects, albeit with a high degree of complexity. Besides knowledge representation and reasoning one would also include the desiderata of machine learning, the nowadays most prominent branch of AI: • Learning. According to Simon Simon1983 learning denotes adaptive changes in a system, enabling to perform tasks more effectively and efficiently. Learning thus includes a certain dynamic element in AI, allowing to automatically modify, extend, or complement the knowledge representation mentioned above. This does not mean that learning happens necessarily online (over the lifetime of the AI)—in contrary, many machine learning systems nowadays learn in an offline fashion. Rather, learning represents a method to incorporate and exploit information which was not present at design time of the AI, regardless of whether learning happens online or offline. The desiderata knowledge representation, reasoning, and learning may serve as a minimalist definition of rational AI or, at the very least, describe its necessary features. Russell and Norvig additionally mention the desiderata perception (computer vision, computer audition), robotics, and natural language processing. In my own opinion, these are natural requirements but are more features describing human-oriented AI. This habilitation thesis describes the essence of my work on the “minimalist core notion of rational AI” described above, putting knowledge representation, learning and reasoning in the center of attention. 1.2 The Role of Probability A central working hypothesis in this work is to recognize probability as a rigorous and consistent tool for reasoning and learning. In the following, I briefly summarize arguments for why probability is an excellent core language for AI. Simplicity Similar as the reasoning tools sketched above, propositional logic and (systems of) equations, probabilistic reasoning is based on some few simple mathematical principles. Arguably, simplicity is key, when it comes to constructing a long-lasting theory of (artificial) intelligence. Probabilistic reasoning can essentially be reduced to two simple rules, the sum rule and the product rule ghahramani2015probabilistic. Semantically, the sum rule, also called marginalization rule, allows us to consistently incorporate unknown facts in our reasoning process, while incorporating the uncertainty associated with these unknown facts. The semantics of the product rule, also called conditioning rule, is to inject information in our reasoning process, that is, basing our reasoning on observed facts. Any probabilistic reasoning task, denoted as probabilistic inference, can then be reduced to a well-prescribed cascade of these two rule, allowing us to propagate information from observations to predictions while consistently treating the uncertainties described by our model. Note that simplicity means here conceptual simplicity, not computational simplicity. Indeed, probabilistic inference (applying the sum and product rule) is in general a “computational nightmare” as it requires summations or integrations which in general scale exponentially in the problem dimensionality. Working around this computational nightmare is a core goal of probabilistic circuits, and hence, of this thesis. Decision Making Probabilistic reasoning is tightly connected with decision making under uncertainty. A classical line of argument are Dutch book arguments, which assert that the betting strategy of an agent (human or artificial) must correspond to some probability distribution over gambling outcomes. Otherwise, a combination of bets, a so-called Dutch book, can be constructed which the agent will accept according to its strategy, which, however, will incur guaranteed total loss. Dutch book arguments do not discuss optimality of the agent’s betting strategy, but rather are a sanity check, arguing which kind of strategies are in principle admissible, namely, those based on probabilistic reasoning. More generally, probability lies at the heart of decision theory berger1990statistical which defines the notion of optimal decision in mere probabilistic terms. Specifically, an optimal decision regarding some target quantity Y is defined as the minimizer of the expected loss, that is, the expectation of a some loss function ℓ(y′,y) (y ,y), expressing the regret when predicting y′y while the true value of Y is y. In that sense, knowledge of the true underlying joint distribution together with rigorous probabilistic inference inevitably leads to optimal decision, in the sense of minimal expected (or long-term) regret under this distribution. Qualitative Similarities to Common Sense Reasoning Furthermore, probabilistic reasoning shares many qualitative features with (human) common sense reasoning, as discussed by Pearl in his classical book “Probabilistic reasoning in intelligent systems: networks of plausible inference” (pearl1988probabilistic). First, probabilistic reasoning features non-monotonic reasoning, i.e. the effect that the degree of plausibility is not a monotonic function of the amount of available information. For example, common sense judges the statement “Tim can fly” as of low plausibility, but learning the information that “Tim is a bird” would lead to an increase of this plausibility. If, however, one learns the additional piece of information that “Tim is sick” one would consequently lower this plausibility again. This mechanism of non-monotonic belief update, i.e. that the plausibility of a statement is not monotonously increasing or decreasing with the amount of information available, is naturally reflected in probabilistic reasoning. Specifically, conditioning (the product rule) displays this feature, as conditional distributions might be arbitrarily different depending on the conditioned information. Several classical AI systems for reasoning under uncertainty were lacking the ability of non-monotonous reasoning pearl1988probabilistic. Another canonical example where probabilistic reasoning parallels human cognitive reasoning is the explaining away phenomenon: two a-priori unrelated causes become correlated upon observing a common effect. For example, a PhD student in ML might observe that (A) their experiments deliver dissatisfying results. Two reasons for this might be (B) the whole theory and foundations of the work are flawed, or (C) there is a bug in the implementation. A priori, statements B and C can be assumed to be uncorrelated. However, when A is observed, then common sense reasoning suggests that learning C makes B less plausible (bringing some relief to the PhD student), showcasing that B and C have become correlated upon observing A. The explaining away effect, as well as other common sense patterns determining relevance among quantities, is well reflected in probabilistic reasoning pearl1988probabilistic. Bayesianism and Consistency with Logic Unlike the classical “hard” reasoning tools, such as logic and systems of equations, probability adds a notion of uncertainty which is a pressing requirement imposed by the real world. A nice feature of probability is that, when restricted to the extreme probabilities 00 and 11, probability emulates classical propositional logic. Moreover, if one accepts the assumptions of Cox’s theorem, then probability is the only sound extension of classical logic to continuous truth or plausibility values, so that one is de facto forced to accept probability in order to be compatible with logic jaynes2003probability. Cox’s theorem is often cited as a theoretical underpinning of the Bayesian approach, which naturally unifies reasoning and learning. The Bayesian perspective allows us to put probabilities on essentially any uncertain quantities of interest, not only those which can arguably be repeated, as required by the classical frequentist notion of probability.11 1 In a nutshell, the classical dispute between Bayesians and frequentists is about how the notion of probability shall be “correctly interpreted.” Probabilistic modelling is then but the task of constructing a joint distribution expressing the dependencies and uncertainties between all involved model parameters22 2 Here, parameter can mean essentially any unknown quantity of interest, not merely model weights. and the data. The typical modelling approach is to specify a prior distribution over parameters and a likelihood relating parameters with the data. The division into prior and likelihood, however, is usually a rather arbitrary choice ghahramani2013bayesian. Then, in the Bayesian approach, learning is but probabilistic reasoning (posterior inference) about parameters given data. Information Theory Information theory was originally designed as a tool of communication engineering shannon1948mathematical, but quickly found applications in many other disciplines, such as biology, psychology, and fundamental physics jaynes1957information. The basic insight is to quantify the information content of an event by the negative logarithm of its probability. As information content and probabilities are merely non-linear but monotonous transformations (log vs. exp) of each other, they are equivalent descriptions of the same quantity. This equivalence is satisfying, as it indicates that (logs of) probabilities are merely measuring information, or actually lack thereof, serving as a natural description of uncertainty. Here, the reason why the information is missing is a subordinate matter and one can avoid vague talk about “true” randomness. Otherwise, one would need to worry whether an opponent’s poker cards are truly random (they are not for them, and I could simply grab the cards and check myself), or the outcome of a game of roulette (which, with sufficiently accurate physical measurement could be predicted arbitrarily well), or the pseudo-random behaviour of a chaotic system which seems random but is actually perfectly deterministic, or the effects on the level of particle physics (Heisenberg’s uncertainty principle introduces a fundamental limit for physical beings). While in these examples that nature of “randomness” seems quite different, this does not matter for modelling and reasoning purposes—one simply quantifies uncertainty, or lack of information, with (log) probabilities. As the information state is generally agent-dependent, this line of argument is reinforcing a Bayesian approach to probabilistic reasoning mackay2003information. This thesis puts forward the working hypothesis that probability is an excellent core language for AI, due to its conceptual simplicity (and hence the possibility to be automated), its ability to express and process uncertainty, as well as many compelling connections to logic, human reasoning, decision theory and information theory. 1.3 Why Probabilistic Circuits? While probability is arguably an excellent learning and reasoning language for AI, it poses substantial computational challenges. For example, probabilistic graphical models (PGM) koller2009probabilistic, a prominent framework for probabilistic AI, are decorated with many hardness results concerning inference and learning. Often, it is relatively easy to construct a PGM accurately reflecting the domain of interest, but in which performing sound probabilistic reasoning (via the sum and product rule) has exponential computational cost in the so-called tree-width of the PGM. Roughly speaking, PGMs and other types of probabilistic models might be easy to represent but “hard to run”. This is in stark contrast to, say, neural networks which are constructed in a way that inference remains easy. Of course, the shortcut here is that neural networks do not perform fully fledged probabilistic reasoning, but only learn a single (or few) reasoning task(s). For example, if one learns a neural classifier predicting class label Y from a feature vector X by minimizing cross-entropy, one really just estimates the conditional distribution pY|p_Y| X with maximum likelihood, i.e. minimizing the Kullback-Leibler divergence between the model distribution and the empirical data distribution. The very same network, however, would have trouble to predict a portion of the features ′⊂ X ⊂ X given the rest of the features ′=∖′ X = X X while ignoring the label Y altogether. Such a predictor cannot be derived in a meaningful way from pY|p_Y| X. Rather, one requires a model over the whole joint pY,p_Y, X, which would allow to compute the desired conditional distribution p′|′p_ X | X . Of course, there are ample neural networks representations for whole joint distributions, generally known as (deep) generative models tomczak2021deep. However, similar as for PGMs, probabilistic inference is generally hard in these models. Can we get best of both worlds? That is, can we design models that—like PGMs and other probabilistic models—represent full joint distributions over the domain of interest, while at the same time allowing to perform flexible inference with the same ease and computational complexity as neural networks? The answer is yes, with probabilistic circuits (PCs)! One way to look at PCs is that they are a kind of hybrid model between PGMs and neural networks. Like PGMs—and unlike “standard” neural nets—they are representations of joint distributions. Unlike PGMs they are able to perform exact and efficient inference, that is, they compute the sum and product rule—as well as many other inference queries—in essentially the same manner and with the same computational cost as neural networks, i.e. by performing one or a few network passes. The key term here is structure: While PCs can be interpreted as neural networks, they need to obey particular constraints guaranteeing that the desired reasoning operations remain tractable. Interestingly, these structural constraints appear at many places in literature, within the probabilistic modelling setting but also in related disciplines such as logic darwiche2002knowledge and databases olteanu2016factorized. Within the probabilistic reasoning domain, these structural patterns appear over and over again, be it in exact inference algorithms such as variable elimination darwiche2009modeling, the junction tree algorithm koller2009probabilistic, and and/or search spaces dechter2007and or tractable probabilistic models such as arithmetic circuits darwiche2003differential, sum-product networks poon2011sum, cutset networks rahman2014cutset, and probabilistic sentential decision diagrams kisa2014probabilistic. Really, PCs do not represent a novel model class. Rather, they aim to consolidate these existing lines of research under one umbrella and using one syntax vergari2020probabilistic; choi2020probabilistic and systematically delineate their differences in terms of structural constraints and corresponding tractable reasoning routines vergari2021compositional. In a nutshell, PCs are a proposed lingua franca for tractable probabilistic modelling. Evidently, PCs don’t offer a free lunch nor do they possess a magical secret sauce to make hard probabilistic inference problems all of the sudden easy. At their core, PCs are models too and serve as an approximations of reality. Their structural constraints ensure that the primary goal—probabilistic inference—remains tractable, but this comes at the cost of limiting the choice of neural network structures. These constraints naturally impose limits on the expressive efficiency of PCs, meaning that some distributions, which can be compactly described as an intractable model, may require exponentially larger representations as a PC. Therefore, the key strategy in PCs is to find the best possible approximation of the data distribution under the constraint that inference remains tractable. This cumulative habilitation thesis describes my contributions to the field of PCs over the last ten years and is organized as follows: In Chapter 2, I introduce basic concepts of probability theory and probabilistic reasoning. In Chapter 3, I illustrate the idea of probability as elegant and widely applicable reasoning tool on the level of distribution functions. Chapter 4 gives a concise overview of state-of-the-art in probabilistic modeling. In Chapter 5, I introduce the framework of PCs and illustrate the contributions I made to this research field. The relevant publications are listed in Part I. Chapter 2 Basic Probability Theory The basic concept in probability is the probability space. The definition of probability space is somewhat abstract and practitioners like to quickly forget it as soon as they get exposed to more intuitive notions like random variables and probability densities. However, it pays off to embrace such foundational concepts to a certain extent. Probability as a mathematical discipline is relatively young, only dating back about 300-400 years, and a firm and concise description of probability was not immediate. Today we have arrived at a compact and rigorous formalisation of probability—the probability space—which fits on roughly half a page and accurately describes the nature of probability. The probability space serves as an insurance and contract: probabilistic methods and models can get fairly abstract and complex and one might get confused about whether what one is doing is still sound. The rule of the game is: can we reduce it back to some probability space (or at least prove its existence)? If yes, we can call it probability. If not, it should be called something else. In other words, the probability space is the “Linux kernel” of probabilistic AI: we usually don’t need to work with it, but knowing how it works will make us better Linux users. In this chapter I just introduce the rudimentary ideas of measure-theoretic probability theory, in order to establish its role as central reasoning instrument in AI. A rigorous treatment can be found for example in billingsley1995; rosenthal2006first. 2.1 Measurable Space The probability space is based on a structured set denoted as measurable space. Definition 1 (Measurable Space). Let Ω be any non-empty set and Σ a sigma-algebra over Ω , i.e. Σ is a set of sub-sets A⊆ΩA . In the following, let A¯≔Ω∖A A A denote the complementary set of A. The sigma-algebra needs to satisfy the following properties: • Ω∈Σ ∈ • A∈ΣA∈ implies that A¯∈Σ A∈ (closed under complement) • for any countable collection of events Aii\A_i\_i it holds that ⋃iAi∈Σ _iA_i∈ . (closed under countable union) The tuple (Ω,Σ)( , ) is a measurable space. Basically, a measurable space is just a non-empty set (Ω ) plus some structure represented as a collection of sub-sets (Σ ). The set Ω is called the sample space and the elements ω∈Ωω∈ are called atomic events. The basic picture in probability is that an element of ω is selected at random from Ω , where “at random” really just means that we are lacking the information which ω is selected. The basic idea of probability is to mathematically model and treat this lack of information. It is important to note that in general we should not assume that an ω is selected repeatedly from Ω , as it is assumed in many classical statistics texts, but rather that exactly one ω is selected, and we do not know which one. The point here is that assuming repeated selection is unnecessarily limiting the theory, and assuming that exactly one ω is selected is in fact the more general picture. Repeated selection of ω is easily subsumed, by “copying the sample space”, i.e. one defines Ωi=Ω _i= for i=1,2,…i=\1,2,…\ and constructs a new sample space as the Cartesian product of the copies Ω′≔×iΩi _i _i. In this duplicated sample space Ω′ , the atomic events are now sequences of draws ω′=(ω1,ω2,…)ω =( _1, _2,…). This construction is also valid for infinite sequences, i.e. when i ranges over the entire ℕN. Besides the sample space Ω , the probability space contains a sigma-algebra Σ , a system of subsets A of Ω , which needs to obey the three rules in Definition 1. It follows automatically from these rules, that also (i) ∅∈Σ ∈ and (i) any countable intersection ⋂iAi _iA_i of Ai∈ΣA_i∈ is again in Σ , i.e. the sigma-algebra is also closed under countable intersection. 2.1.1 Events are Sets The elements of Σ are called events. This nomenclature hints that while the atomic events ω represent the “finest resolution” of the universe Ω , the sigma-algebra Σ contains events at a more “macroscopic level”. Example 1 illustrates this concept. Example 1 (Events for a die throw). When modelling a die, a suitable sample space is Ω=1,2,3,4,5,6 =\1,2,3,4,5,6\ representing all six possible outcomes of the die throw. We might decide that this is too fine-grained for our purposes and that—for whatever reason—we are just interested in two events, namely (i) whether the die shows a prime number and (i) whether it shows an odd number. The die shows a prime number if it turns out that ω is contained in the set Ap=2,3,5A_p=\2,3,5\ and it shows an odd number if ω is in Ao=1,3,5A_o=\1,3,5\. One can convince oneself that—as soon as the sample space Ω is fixed—indeed any thinkable event can be encoded by whether or not ω∈Aω∈ A where A is some subset of Ω . We can find the most concise sigma-algebra containing ApA_p and AoA_o by starting with Σ0=Ap,Ao,Ω _0=\A_p,A_o, \ and iterating Σi+1 _i+1 ←Σi∪A¯:A∈Σi∪A∪B:A,B∈Σi ← _i∪\ A A∈ _i\∪\A∪ B A,B∈ _i\ that is, we repeatedly include all complements and pairwise unions of events. This process will—for any finite Ω —converge and deliver the most concise sigma-algebra containing the desired events. Here we get Σ= = ∅,1,2,1,2,3,5,4,6, \ ,\1\,\2\,\1,2\,\3,5\,\4,6\, 1,3,5,1,4,6,2,3,5,2,4,6, \1,3,5\,\1,4,6\,\2,3,5\,\2,4,6\, 1,2,3,5,1,2,4,6,3,4,5,6, \1,2,3,5\,\1,2,4,6\,\3,4,5,6\, 1,3,4,5,6,2,3,4,5,6,Ω \1,3,4,5,6\,\2,3,4,5,6\, \ We see that this sigma-algebra does not contain all of the singleton atomic events—it contains 1\1\ and 2\2\, but for example 3\3\ and 4\4\ are not contained in Σ . That is, Σ represents a more “macroscopic” view of Ω and contains only ApA_p and AoA_o plus all the necessary events to get a valid sigma-algebra. After fixing Ω , any thinkable event can be described as whether ω is contained in some prescribed set A⊆ΩA and hence any such subset A deserves the name “event”. Thus, we will sometimes say things like “event A happens,” meaning really that ω∈Aω∈ A. The basic role of Σ is to collect the events we are interested in. Moreover, the structure of the sigma-algebra just ensures that we have a closed logical system jaynes2003probability: • The sigma-algebra needs to be closed under complement, which means that for any event we consider, we also must consider the opposite, i.e., that the event does not happen. This simply amounts to logical negation. • The sigma-algebra needs to be closed under countable union, i.e., for any countable collection of events we need also to consider the event that any of them happens. This amounts to logical or. • It follows automatically due to De Morgan’s laws that the sigma-algebra is closed under countable intersection, i.e., for any countable collection of events we need also to consider the event that all of them happen. This amounts to logical and. • Further logical connectives follow, such as closedness under symmetric set difference (logical xor). We can now define the notion of probability space. 2.2 Probability Space While a measurable space is a non-empty set Ω together with a logical structure Σ of sub-sets, a probability space adds the probability measure, a function defined on Σ . Definition 2 (Probability Space). Let (Ω,Σ)( , ) be a measurable space. Let ℙ P be a function Σ↦[0,1] [0,1] mapping events to real numbers between 00 and 11, with the properties • ℙ(Ω)=1 P( )=1 • for any countable collection of disjoint events Aii\A_i\_i it holds that ℙ(⋃iAi)=∑iℙ(Ai) P ( _iA_i )= _i P(A_i) (countable additivity) Such function ℙ P is called a probability measure defined on (Ω,Σ)( , ). The triplet (Ω,Σ,ℙ)( , , P) is called a probability space. Thus, a probability space equips a measurable space with a function ℙ P which assigns to each event a real number—the probability of the event—such that the whole Ω gets assigned 11 and that probabilities of disjoint events add up. Note that from this definition it follows that ℙ(∅)=0 P( )=0 and ℙ(A¯)=1−ℙ(A) P( A)=1- P(A). The probability space according to Definition 2 fully characterizes the nature of probability as understood by current mainstream mathematics. Any probabilistic argument can be reduced to a sample space Ω , a sigma-algebra Σ over Ω and a probability measure ℙ P defined on Σ . Given that probability is a general and powerful tool, this definition is a truly compressed description of the matter. 2.2.1 Why Sigma-Algebras? Newcomers to probability often wonder why sigma-algebras are included in the basic definition of probability space. Ultimately, we aim to assign probabilities to events, which is the role of the probability measure. We do we need Σ ? Why can’t we simply just consider all possible events, i.e. all possible subsets A⊆ΩA ? In other words, one would want to—without loss of generality—define ℙ P on the power set (set of all subsets):11 1 Note that the power set is indeed a sigma-algebra, namely the largest possible one. 2Ω≔A:A⊆Ω.2 \A A \. In that way, one could omit sigma-algebras altogether and make the basic definition of probability space even simpler. This would surely be the way to proceed if it was mathematically meaningful. Sigma-algebras, if one would want them to express a “coarse-grained” structure, could be included at a later stage, but not in the core definition of probability. And indeed, we can safely define ℙ P on all events, as long as Ω is countable, i.e., finite or of the same cardinality as the natural numbers. However, it turns out that when Ω is uncountable, e.g. the real numbers Ω=ℝ =R, the power set becomes “too big” to be used as sigma-algebra. Even something simple such as a uniform distribution over some interval of the real line cannot be constructed in a consistent way. These troubles are not private to probability theory but go back to measure theory, which is concerned with assigning measures such as volume, length, mass—and also probability—to sets. The classical question of measure theory was whether the notion of length can be generalized from intervals such as [a,b][a,b], which naturally has length b−ab-a, to arbitrary subsets on the real line. The answer to this is negative, meaning that there exist sets which cannot be assigned a meaningful length, as it would break one or more desiderata about such length measure (countable additivity, translation invariance etc.). Those non-measurable sets are rather abstract and are constructed in a rather indirect way by employing the axiom of choice,22 2 The existence of non-measurable sets is in fact equivalent to the axiom of choice. An easy to follow illustration of the problem is given in Rosenthal’s book rosenthal2006first. These non-measurable sets should be excluded from the discussion and only measurable sets should be included. Exactly this is the primary usage of sigma-algebras and the reason why they are included in the basic definition of probability. There is a standard choice of sigma-algebra when one is working with the real numbers, i.e., Ω=ℝ =R, or the D-dimensional Euclidean space, i.e. Ω=ℝD =R^D, namely the Borel sets. The Borel sets include any subset one could (constructively) think of (and many more), forming the Borel sigma-algebra. They are easiest defined via generated sigma-algebras. Definition 3 (Generated Sigma-Algebra). Let E be any set of subsets of Ω . The sigma-algebra generated by E is Σ(E)≔⋂E⊆Σ, (E) _E , that is, the intersection of all sigma-algebras containing E. Note that in Definition 3 we do not require any special properties from E, but any collection of subsets of Ω is fine. It is quite easy to prove that Σ(E) (E) is indeed a sigma-algebra. Furthermore, we can rightfully call it the smallest possible sigma-algebra containing E, since it it contains exactly the sets which need to occur in all sigma-algebras containing E. With this tool at hand, the Borel sigma-algebra can be defined as Definition 4 (Borel Sets, Borel Sigma-Algebra). The Borel sigma-algebra on ℝR is defined as ℬ≔Σ([a,b]|a,b∈ℝ,a≤b)B (\[a,b]\,|\,a,b ,a≤ b\) that is, the sigma-algebra generated by the set of all closed intervals. Alternatively, one can use the open intervals, half-open intervals, etc., which are all equivalent definitions of ℬB. A likewise definition can be made for ℝDR^D, by using the sigma-algebra generated by (open or closed) hypercubes, or alternatively the set of all open (or closed) balls, etc. In conclusion of this section: sigma-algebras contain those events one wants to consider and make sure that events are closed under set operations (logic connectives). The main reason that they are in the basic definition of probability space is to “fix a bug” and make the math work. 2.3 Interpretations of Probability The definition of probability space requires about half a page and precisely sets the formalism and rules to work with probability. While it is a crisp and minimalist description of the nature of probability, it lacks intuition about “what probability actually is”. We might think about probability in the following ways. • Relative Frequencies. Relative frequencies are helpful for interpreting probabilities and follow from the law of large numbers. Classically, they served as definition of probabilities, before their formalization as in Definition 2. Given a probability space (Ω,Σ,ℙ)( , , P), we might construct n independent copies of it. Intuitively, when figuring the probability space as an urn containing various coloured balls, we would construct n identical urns and let n independent parties perform the draws. The result is then a sequence (or set) of independent and identically distributed draws =(ω1,ω2,…,ωn)∈Ωn ω=( _1, _2,…, _n)∈ ^n. The law of large numbers now guarantees that given any event A∈ΣA∈ limn→∞∑i=1n[ωi∈A]n=a.s.ℙ(A), _n→∞~~ _i=1^n[ _i∈ A] n a.s.= P(A), where [⋅][·] denotes the Iverson bracket, evaluating to 11 for true arguments and 00 for false arguments. Hence, ∑i=1n[ωi∈A] _i=1^n[ _i∈ A] is the number of times the atomic event has been picked from A across the independent copies of the probability space. Normalizing by n gives us a relative frequency between 00 and 11. The abbreviation a.s.a.s. means almost surely, that is, the equality holds with probability 11 (in the constructed probability space over sequences ω). Hence, drawing the atomic element repeatedly, independently and in identical manner, the relative frequency of how often event A happens approaches ℙ(A) P(A). • Relaxation of Logic Truth Values. A probability measure assigns a real number to each of the considered events. At least for two of these real numbers we have a concrete interpretation, namely for 00 and 11. The whole sample space Ω , but perhaps also other events A, get assigned probability 11, which is naturally interpreted as the logical value truetrue. Conversely, the empty set, but perhaps also other events, get the value 00, naturally interpreted as falsefalse. No matter which ω is picked, it will certainly be contained in Ω and it will certainly not be in ∅ . Moreover, if we restricted the set of return values of ℙ P to 00 and 11, any propositional logic theory can be emulated by constructing a suitable probability space. In the general case, where probabilities are between 00 and 11, we might naturally interpret probabilities as plausibility values. The closer a probability is to 11 the more plausible is its occurrence and the closer it is to 00 the less plausible its occurrence. The rules of probability further dictate that the probability of a union of disjoint events (amounting to a disjunction of logically incompatible statements) should simply add up, which is reasonable. Furthermore, Cox’s theorem (jaynes2003probability) asserts that—under particular “common sense assumptions”—probability is de facto the only sound extension of propositional logic to real numbers. • Information. Information theory provides a natural interpretation of probability as information content. Shannon shannon1948mathematical defined the information content of an event A as −logℙ(A)- P(A) based on the desiderata that – an event which occurs certainly should convey zero information – less probable events (i.e. events which are “closer” to impossibility ∅ ) should convey more information – information of independent events33 3 The notion of independence will be defined in Section 2.4.4. should add up The negative logarithm is the only function satisfying these desiderata, where a degree of freedom concerning the base of the logarithm remains. When using the logarithm to base 22 information content is measured in bits. A probability of 0.50.5, for example the outcome of a fair coin flip, translates to 1bit1\,bit, making intuitively sense. The logarithm to base e expresses information in nats. As information content of an event is a bijective function of its probability, probability and information content are basically the same thing. None of these interpretations should be treated as the ‘ultimate correct one’. The question how to ‘correctly’ interpret probabilities has been long a point of dispute between ‘frequentists’ and ‘Bayesians’. For frequentists, the interpretation as relative frequencies is more appealing, while for Bayesians the interpretation as plausibility values of information content is natural.44 4 The Bayesian camp sometimes called probabilities “subjective beliefs”, which is actually an invitation for being criticised for “not being objective” or “believing instead of knowing”. However, the idea of this name bears wisdom: probabilities represent the information status about a particular domain, which, of course, is always depending on the agent (e.g. I know my cards in poker, but not yours, and vice versa). To reflect this idea, I would suggest the term “agent-dependent information status” rather than “subjective beliefs”. It is advisable to move beyond discussions about the “true nature” of probability. Different interpretations of probability—and the ability to switch between them—should be understood as a sign of richness and justification of the theory. Regardless of interpretation, we shall embrace probability as what it is at its core: a consistent and rigorous reasoning calculus under uncertainty, based on a few simple principles. 2.4 Fundamental Laws of Probability Probabilistic modelling entails constructing a probability space that represents the domain of interest together with any uncertainties, addressing the desideratum of knowledge representation in AI, as discussed in Section 1.1. The second desideratum is reasoning, i.e. using our knowledge to answer queries of interest. An important requirement of any reasoning tool is conceptual simplicity, that is, reasoning primitives should be relatively few and easy to understand. As we will see in Chapter 3, the core of probabilistic reasoning relies on a few core reasoning primitives, in particular the sum rule and product rule. We will discuss these rules on the level of distribution functions (introduced in Section 2.5.2), but they correspond to more fundamental laws on the level of probability measures. We will briefly discuss these laws in the following. 2.4.1 Law of Total Probability (The Sum Rule) Let a probability space (Ω,Σ,ℙ)( , , P) be given and let B∈ΣB∈ be an event. Let A1,A2,…A_1,A_2,… be a countable collection of exclusive (i.e. Ai∩Aj=∅A_i∩ A_j= for i≠ji =j) and exhaustive (i.e. ∪iAi=Ω _iA_i= ) events, that is, they form a partition of Ω . Let now B∩AiB∩ A_i be the joint event that both B and AiA_i happen. The law of total probability states ℙ(B)=∑iℙ(B∩Ai). P(B)= _i P(B∩ A_i). (2.1) This law follows directly from the countable additivity property of probability measures (Definition 2) since the joint events B∩AiB∩ A_i form a partition of B, hence the sum of their probabilities must equal ℙ(B) P(B). As a reasoning primitive, the law of total probability, or sum rule, can be interpreted as ignoring, accounting for unknown facts or forgetting. In particular, figure that we have elicited all the probabilities of the joint events B∩A1,B∩A2,…B∩ A_1,B∩ A_2,…, that is, a rather detailed information status about whether B and A1A_1 happen, B and A2A_2 happen, etc. By summing over these probabilities, we essentially forget (ignore, account for different possibilities) regarding the exclusive events AiA_i. Example 2 illustrates the concept. Example 2 (Law of Total Probability). Consider a sample space Ω representing a population of people, i.e. each ω∈Ωω∈ represents a person. Let S⊂ΩS⊂ be the set of all smokers and further • A1⊂ΩA_1⊂ be the persons of age <10<10 • A2⊂ΩA_2⊂ be the persons of 10≤10≤ age <20<20 • A3⊂ΩA_3⊂ be the persons of 20≤20≤ age <50<50 • A4⊂ΩA_4⊂ be the persons of 50≤50≤ age Consequently, ℙ(S∩A1) P(S∩ A_1) is the probability that somebody smokes and is younger than 1010 years, ℙ(S∩A2) P(S∩ A_2) the probability that somebody smokes and is between 1010 and 2020, etc. Rather than keeping all these probabilities, we might decide to forget about age and compute the probability of smoking as ℙ(S)=ℙ(S∩A1)+ℙ(S∩A2)+ℙ(S∩A3)+ℙ(S∩A4) P(S)= P(S∩ A_1)+ P(S∩ A_2)+ P(S∩ A_3)+ P(S∩ A_4) 2.4.2 Conditional Probability (The Product Rule) The second central reasoning primitive in probability is conditional probability. Definition 5 (Conditional Probability). Given an arbitrary probability space (Ω,Σ,ℙ)( , , P), let A,B∈ΣA,B∈ be two arbitrary events, where ℙ(B)>0 P(B)>0. Then the conditional probability of A given B is ℙ(A|B)=ℙ(A∩B)ℙ(B). P(A\,|\,B)= P(A∩ B) P(B). (2.2) ℙ(A|B) P(A\,|\,B) is simply the probability of A after asserting that ω∈Bω∈ B. In particular, ℙ(B|B)=1 P(B\,|\,B)=1, as should be expected. While the law of total probability (sum rule) shall be interpreted as ignoring, forgetting, or accounting for unknown facts, conditional probability shall be interpreted as observing or injecting information. In particular, while the probability space (Ω,Σ,ℙ)( , , P) is our “global” mathematical model of uncertainty, conditional probability essentially “rebases” the probability space on B, and updates our model based on the information that ω∈Bω∈ B. This is indeed correct as we can define a conditional probability space as follows: • Define B as the new sample space. • Define a sigma-algebra Σ′ as Σ′=A∩B|A∈Σ, =\A∩ B\,|\,A∈ \, i.e., the collection of the intersection of each original event with B. It can be shown that Σ′ is indeed a sigma-algebra over B. • Define a (conditional) probability measure ℙ′ P on Σ′ as ℙ′(A′)≔ℙ(A′)ℙ(B)=ℙ(A∩B)ℙ(B) P (A ) P(A ) P(B)= P(A∩ B) P(B) Note that ℙ(A′) P(A ) is well-defined, since any A′A is given as the intersection A′=A∩BA =A∩ B of events in the original Σ . Hence also A′∈ΣA ∈ and ℙ(A′) P(A ) is defined. Then (B,Σ′,ℙ′)(B, , P ) is again a probability space, conditional on ω∈Bω∈ B. Thus, we might see conditional probability as a tool that transforms our original probability space into a new one, accounting the provided information ω∈Bω∈ B. Example 3 illustrates the concept. Example 3 (Conditional Probability Space). Let Ω be the sample space of a given probability space and B an event we condition on. The figure below illustrates how various events A get translated into events A′=A∩BA =A∩ B on the conditional probability space defined on B. Conditional probability ℙ(A|B)=ℙ(A∩B)ℙ(B)=ℙ(A′)ℙ(B) P(A\,|\,B)= P(A∩ B) P(B)= P(A ) P(B) can now be interpreted as bona-fide probability measure on the sample space B. One does not necessarily need to view B as the new sample space, but one can also keep the entire Ω . Of course, the conditional probability for any set A which does not overlap with B must be 00 then. 2.4.3 Bayes’ Rule (The Rule of Inverse Probability) The product rule immediately delivers Bayes’ rule. Equation (2.2) can be written as ℙ(A∩B)=ℙ(A|B)ℙ(B), P(A∩ B)= P(A\,|\,B)\, P(B), and by symmetry we get ℙ(A∩B)=ℙ(B|A)ℙ(A), P(A∩ B)= P(B\,|\,A)\, P(A), Equating the right hand sides and dividing by ℙ(B) P(B), we get Bayes’ rule: ℙ(A|B)=ℙ(B|A)ℙ(A)ℙ(B). P(A\,|\,B)= P(B\,|\,A)\, P(A) P(B). (2.3) Bayes’ rule is often called the law of inverse probability, as (2.3) essentially reverses the direction of reasoning. Of course, by symmetry we also get ℙ(B|A)=ℙ(A|B)ℙ(B)ℙ(A). P(B\,|\,A)= P(A\,|\,B)\, P(B) P(A). (2.4) Bayes’ rule is incredibly powerful, since one “conditional direction” (say ℙ(A|B) P(A\,|\,B)) is often easy to describe while one is actually interested in the other direction (ℙ(B|A) P(B\,|\,A)). This is the general setting of inverse problems, which are ubiquitous in science and engineering, such as in imaging, detection, and robotics. Thus, Bayes’ rule, while being simple, describes the solution to the vast majority of these problems. However, such conceptional simplicity does not mean computational simplicity, as most Bayesian problems are numerically challenging. 2.4.4 (Conditional) Independence Probabilities reflect the information content of an event. Hence, conditional probabilities lead naturally to the notion of independence. When we consider an event A whose probability does not change upon observing B, we define that A and B are independent of each other, denoted as A⟂BA \!\!\! B: A⟂B⇔ℙ(A|B)=ℙ(A)A \!\!\! B~~~ ~~~~ P(A\,|\,B)= P(A) (2.5) Due to the product rule ℙ(A∩B)=ℙ(A|B)ℙ(B) P(A∩ B)= P(A\,|\,B)\, P(B) we also get A⟂B⇔ℙ(A∩B)=ℙ(A)ℙ(B)A \!\!\! B~~~ ~~~~ P(A∩ B)= P(A)\, P(B) (2.6) and further, since ℙ(A∩B)=ℙ(B|A)ℙ(A) P(A∩ B)= P(B\,|\,A)\, P(A), A⟂B⇔ℙ(B|A)=ℙ(B)A \!\!\! B~~~ ~~~~ P(B\,|\,A)= P(B) (2.7) which is the symmetrical case to (2.5). Hence, (2.5), (2.6) and (2.7) are equivalent definitions of independence. Furthermore, independence can be conditional on some other event. In particular, as illustrated Section 2.4.2, conditional probability gives rise to a conditional probability space. By simply applying the concept of independence to the conditional probability space, we get the notion of conditional independence. Specifically, let A, B and C be events, where ℙ(C)>0 P(C)>0. Then, A and B are conditionally independent, conditionally on C, written as A⟂B|CA \!\!\! B\,|\,C, if the following equivalent properties hold: A⟂B|C A \!\!\! B\,|\,C~~~ ⇔ℙ(A|B,C)=ℙ(A|C) ~~~~ P(A\,|\,B,C)= P(A\,|\,C) (2.8) A⟂B|C A \!\!\! B\,|\,C~~~ ⇔ℙ(B|A,C)=ℙ(B|C) ~~~~ P(B\,|\,A,C)= P(B\,|\,C) (2.9) A⟂B|C A \!\!\! B\,|\,C~~~ ⇔ℙ(A,B|C)=ℙ(A|C)ℙ(B|C) ~~~~ P(A,B\,|\,C)= P(A\,|\,C)\, P(B\,|\,C) (2.10) Note that they are the same as (2.5), (2.6) and (2.7), except that all probabilities are conditioned on C. 2.5 Random Variables So far, we have discussed probability using its bare-bone measure theoretic definition: We reflect our domain using a (possibly abstract) sample space Ω , which is just a non-empty set. The only thing which “happens” is that an atomic element ω is selected, and we don’t know which one. Our ignorance about which ω is selected is modelled by assigning real numbers—probabilities—between 00 and 11 to all kind of events in a consistent way, namely, that they add up for disjoint events. Probability spaces are the “Linux kernel” of probability, a minimalist and simple theory which, however, unfolds into the rich structure of an intelligent calculus. However, we usually don’t want to work in the Linux kernel, but use an interpretable and high-level interface to work with. The first step towards this interface are random variables (RVs). The basic idea of random variables is to map the abstract sample space Ω into something more interpretable, such as the real numbers ℝR. Thus, a random variable X is really just a function X:Ω↦ℝX , assigning each ω∈Ωω∈ to some X(ω)∈ℝX(ω) . Since the selection of ω is random, also the value returned by X will be random, which is why a (deterministic) function defined on a probability space is called a “random variable”. Evidently, there is no reason to confine random variables to only return real numbers. Rather, depending on the application, one would want them to return complex numbers, tuples of real numbers (vectors), graphs, functions, etc. Thus, a random variable in general is just a transformation of one sample space Ω to some another (interpretable) space X. In order to consistently work with probability represented by the probability space (Ω,Σ,ℙ)( , , P), we will require that X is measurable, which is defined as follows. Definition 6 (Measurable Function). Let (Ω,Σ)( , ) and (,ΣX)(X, _X) be measurable spaces and let X:Ω↦X be a function. X is called measurable if for each B∈ΣXB∈ _X it holds that X−1(B)∈Σ,X^-1(B)∈ , where X−1X^-1 is the preimage of B under X, i.e.55 5 The symbol for pre-image is the same as for inverse function, but these two are distinct concepts. In particular, a function might or might not have an inverse, but the pre-image is always defined. X−1(B)≔ω∈Ω|X(ω)∈B.X^-1(B) \ω∈ \,|\,X(ω)∈ B\. Measurability of a function requires that both domain Ω and co-domain X are equipped with sigma-algebras Σ and ΣX _X, respectively, and that the pre-images of the events in ΣX _X are all contained in Σ . It is thus a condition on the function itself as well as the measurable spaces (Ω,Σ)( , ) and (,ΣX)(X, _X). Often one would fix the function of interest and design the sigma algebras such that the function indeed becomes measurable. The defining part of a random variable X is that it is a function defined on a probability space, mapping into a “more interpretable space” X, often called the state space of X. Since the selection of ω∈Ωω∈ is uncertain also the value (state) of X(ω)∈X(ω) is uncertain. This “transformed” uncertainty is described by the distribution of a random variable. 2.5.1 Distribution of a Random Variable Given a probability space (Ω,Σ,ℙ)( , , P) and a random variable X defined on this space and mapping into the measurable space (,ΣX)(X, _X), we can define the following function: ℙX:ΣX↦[0,1],where for any B∈ΣX:ℙX(B)≔ℙ(X−1(B)). P_X _X [0,1],~~~where for any B∈ _X P_X(B) P(X^-1(B)). Function ℙX P_X just assigns to each event B∈ΣXB∈ _X the probability which is assigned by ℙ P to the preimage X−1(B)X^-1(B), i.e. the set of all ω’s mapping to B. Since the random variable is measurable it is guaranteed that X−1(B)∈ΣX^-1(B)∈ , hence ℙX P_X is properly defined. It can be shown that ℙX P_X is indeed a probability measure, now defined on (,ΣX)(X, _X), and hence (,ΣX,ℙX)(X, _X, P_X) is a probability space. ℙX P_X is called the distribution induced by X, the law of X, or the pushforward measure of ℙ P under X, and it adequately describes our uncertainty about the value X(ω)X(ω). 2.5.2 Distribution Functions The introduction of random variables has just transformed the uncertainty over an “uninterpretable” space Ω into uncertainty over a “more interpretable” space X. The latter is still described with a probability measure which is a rather cumbersome mathematical object. One also might ask why we did the hassle to first define a probability space (Ω,Σ,ℙ)( , , P) and a measurable function X:Ω↦X just to end up with a new probability space (,ΣX,ℙX)(X, _X, P_X) describing the uncertain quantity X. On this abstract level, it would be more straightforward to construct our model (,ΣX,ℙX)(X, _X, P_X) directly. In the following, we will thus ignore the underlying probability space (Ω,Σ,ℙ)( , , P) and just aim to describe (,ΣX,ℙX)(X, _X, P_X) directly by the means of distribution functions. The two most widely used distribution functions are probability mass functions and probability density functions. Definition 7 (Probability Mass Function (PMF)). Let X be a random variable with a countable state space X,66 6 A random variable with countable state space is called discrete. equipped with sigma-algebra ΣX=2 _X=2^X. The probability mass function of X is defined as pX:↦ℝ,pX(x)=ℙX(x)p_X ,~~~~~p_X(x)= P_X(\x\) which assigns to each state x∈x the probability that X=xX=x. A PMF is a simple and direct way to specify probability distributions. In particular, the probability of any event A⊆A is simply ℙX(A)=∑x∈ApX(x), P_X(A)= _x∈ Ap_X(x), (2.11) since any A⊆A is countable and its probability must be given by the countable sum over the probabilities of the states in A, see Definition 2. However, PMFs can only be defined for discrete random variables, as they assign probabilities in a “discrete” way to each atomic state x∈x . This requires that we assume the power set 22^X as sigma-algebra, which is fine for discrete state spaces but does not work for uncountable state spaces, such as ℝR or ℂC. For such random variables one commonly uses probability densities instead. Definition 8 (Probability Density Function (PDF)). Let X be a random variable with the real numbers as state space, =ℝX=R, equipped with some sigma-algebra ΣX _X (usually the Borel sets) and probability measure ℙX P_X. Let pXp_X be a function mapping from X to the non-negative real numbers, pX:↦[0,∞]p_X [0,∞] with the property that ∀A∈ΣX:ℙX(A)=∫ApX(x)x,∀ A∈ _X P_X(A)= _Ap_X(x)\,dx, (2.12) that is, for any event A∈ΣXA∈ _X the probability ℙX(A) P_X(A) is given by the integral of pXp_X over A. Then pXp_X is called a probability density function of X, also just probability density or density. A random variable which admits a density is called continuous. The probability density, if it exists, is not unique. In particular, any density pXp_X can be changed at a countable collection of points without changing the integral (2.12) for any A. Note that both PMFs and PDFs are denoted by the same symbol pXp_X. The intuitive reason for this is that both serve the same purpose, namely to represent a probability measure ℙX P_X of a random variable X, either via a sum (2.11) or an integral (2.12). Moreover, within a measure-theoretic treatment of probability these two concepts become in fact the same. Specifically, when μ is any measure defined on (,ΣX)(X, _X) and pX:↦[0,∞]p_X [0,∞] is a measurable function with ∀A∈ΣX:ℙX(A)=∫ApXμ∀ A∈ _X P_X(A)= _Ap_X\,dμ (2.13) then pXp_X is called a Radon–Nikodym derivative of ℙX P_X with respect to μ. In that sense, a PMF is just a Radon-Nikodym derivative with respect to the counting measure and a PDF is just a Radon-Nikodym derivative with respect to Lebesgue measure (capturing the notion of length, area, volume, etc.). For brevity, we might just use the shorter term density for pXp_X and also be lose about whether we speak about a discrete random variable (hence using sums) or a continuous random variable (hence using integrals). 2.5.3 Multivariate Random Variables and Joint Distributions So far we were concerned mainly with univariate random variables, returning a “single” value. However, the usual tasks in science and engineering are to describe how multiple quantities are entangled with each other. We again consider some (abstract) probability space (Ω,Σ,ℙ)( , , P) and define now multiple random variables on it. We might call them X, Y, Z or more systematically enumerate them as X1,X2,…,XDX_1,X_2,…,X_D, where D∈ℕD , and let 1,2,…,DX_1,X_2,…,X_D be their state spaces. Now, since the mental picture is that some atomic event ω∈Ωω∈ is selected, where ℙ P describes our ignorance about this selection, the returned values X1(ω),X2(ω),…,XD(ω)X_1(ω),X_2(ω),…,X_D(ω) will be uncertain but (in general) also correlated with each other. The discussion of multivariate random variables really does not add much mathematical depth to univariate random variables. In fact, one simply defines a random tuple X (also often referred to as random vector or set of random variables) as the function :Ω↦,(ω)≔(∞(ω),∈(ω),…,(ω)) X X,~~~~~ X(ω) (X_1(ω),X_2(ω),…,X_D(ω)) mapping from Ω to the Cartesian product of the state spaces ≔×⟩=∞⟩ X _i=1^DX_i and whose ithi th component is the univariate random variable XiX_i. In order to assert that X is a (vector-valued) random variable one needs to ensure that X is measurable whenever the univariate random variables X1,X2,…,XDX_1,X_2,…,X_D are measurable. Indeed, one can show that X is measurable with respect to the so-called product sigma-algebra Σ _ X which is the sigma-algebra generated by E=×i=1DAi|Ai∈iE= \ _i=1^DA_i\,|\,A_i _i \, i.e. the set of all Cartesian products of any events of the univariate random variables. Thus, X can be understood as a standard random variable, albeit one mapping to the multi-dimensional space X and equipped with product sigma-algebra Σ _ X. The concept of distribution functions carries over to multivariate random variables as follows. Definition 9 (Joint Probability Mass Function (Joint PMF)). Let =(X1,…,XD) X=(X_1,…,X_D) be a random vector, consisting of discrete univariate random variables X1,…,XDX_1,…,X_D with countable state spaces 1,…,DX_1,…,X_D. The joint probability mass function is defined as p:↦[′,∞],√(§)=(§)p_ X X [0,1],~~~~~p_ X( x)= P_ X(\ x\) which assigns to each joint state x the probability that = X= x. Similarly to univariate random variables the joint PMF describes the probability measure of X via ℙ(A)=∑∈Ap(). P_ X(A)= _ x∈ Ap_ X( x). (2.14) for any event A∈ΣA∈ _ X. Furthermore, also the concept of PDF carries over to the multivariate case. Definition 10 (Joint Probability Density Function (Joint PDF)). Let =(X1,…,XD) X=(X_1,…,X_D) be a random vector, consisting of univariate random variables X1,…,XDX_1,…,X_D each with state space ℝR and equipped with the Borel sigma-algebra. Let p_ X be a function mapping from ℝDR^D to the non-negative real numbers, p:ℝD↦[0,∞]p_ X ^D [0,∞], with the property that ℙ(A)=∫Ap(), P_ X(A)= _Ap_ X( x)\,d x, (2.15) for any event (Borel set) A⊆ℝDA ^D. Then p_ X is called a joint probability density of X. The integral (2.15) (or sum (2.14)) is the defining part of a joint distribution function p_ X: when integrating (or summing) it over an event A∈ΣA∈ _ X, it needs to return ℙ(A) P_ X(A). From this perspective, one can also define hybrid distribution functions over sets of random variables X which contains both discrete and continuous ones. Definition 11 (Hybrid Distribution Function). Let =(X1,…,XD) X=(X_1,…,X_D) be a random vector where ′=(X1,…,XK) X =(X_1,…,X_K) are discrete random variables and ′=(XK+1,…,XD) X =(X_K+1,…,X_D) are continuous random variables,77 7 That the first K random variables are discrete and the others continuous is merely an assumption for convenience of notation, which can be made without loss of generality. and let =×⟩=∞⟩ X= _i=1^DX_i be their joint state space. For any event A∈ΣA∈ _ X let A′≔(x1,…,xK)|(x1,…,xD)∈AA \(x_1,…,x_K)\,|\,(x_1,…,x_D)∈ A\ i.e., the set of all states assumed by the discrete random variables in A. Furthermore, for each ′∈A′ x ∈ A let A′≔(xK+1,…,xD)|(x1,…,xD)∈A∧(x1,…,xK)=′A _ x \(x_K+1,…,x_D)\,|\,(x_1,…,x_D)∈ A (x_1,…,x_K)= x \ i.e., the set of all states assumed by the continuous random variables assumed in A, whenever the discrete random variables assume state ′ x . Let p:↦[′,∞]p_ X X [0,∞] be a function with the property that for any A∈ΣA∈ _ X ℙ(A)=∑′∈A′∫A′p(′,′)d′. P_ X(A)= _ x ∈ A _A _ x p_ X( x , x )\,d x . (2.16) Then p_ X is called a hybrid distribution function over X. The definition of hybrid distribution functions is a bit cumbersome, as it requires us to split random variables and their state spaces into discrete and continuous ones. Furthermore, all the joint distributions—joint PMFs, joint PDFs, and hybrid distribution functions—can be understood as densities in a measure-theoretic sense, as in (2.13). The only difference between these is just the base measure: for discrete random variables one uses a counting measure, for continuous random variables one typically uses the Lebesgue measure, and for the hybrid case one would use an adequate product measure of counting and Lebesgue measure. Hence, similarly as in the univariate case we use the same symbol p_ X for joint PMFs, joint PDFs and hybrid distribution functions, as they all serve the same purpose—describing a probability measure ℙ P_ X by integrating (or summing) p_ X over some event A. Chapter 3 Probabilistic Inference As discussed in Section 1.1, a core property of any AI system is to have some representation of a knowledge base. This role is now fulfilled by distribution functions p_ X introduced in the last chapter, representing both dependencies between random variables as well as our uncertainty about them. Besides representing our knowledge as a distribution function p_ X we ultimately are interested in reasoning, or inference, i.e. answering queries of interest. Probability naturally offers inference routines in order to perform reasoning under uncertainty. The two most important routines are marginalization (the sum rule) and conditioning (the product rule), where the latter just uses the former as a sub-routine. Hence, marginalization is really the core business of probabilistic inference. Besides these two central inference routines there are several other fundamental operations one would want to do with probability distributions, in particular taking expectations and performing optimization, i.e. taking maxima or minima of functions of interest. As it turns out, however, most models mentioned above struggle with computing these queries, as they are typically NP-hard problems in these. Probabilistic circuits (PCs), which we introduce in Chapter 5, will allow to compute these queries exactly and efficiently. Before diving into PCs, however, in this chapter we shall study the elegant reasoning calculus probability has to offer, disregarding computational issues. In fact, one of the things which make probabilistic models so interesting is the tension between the conceptional simplicity of the calculus—it is in principle clear what shall be done—and the computational hardness involved when implementing the calculus. 3.1 Marginalization (The Sum Rule) Let a distribution function p_ X for a random vector =(X1,…,XD) X=(X_1,…,X_D) be given and let =(Y1,…,YD′) Y=(Y_1,…,Y_D ) and =(Z1,…,ZD′) Z=(Z_1,…,Z_D ) be a partition of X, i.e. ∪= Y∪ Z= X and ∩=∅ X∩ Z= . We assume without loss of generality that Y are the first D′D entries in X and Z the remaining D′=D−D′D =D-D entries, i.e. =(Y1,…,YD′,Z1,…,ZD′). X=(Y_1,…,Y_D ,Z_1,…,Z_D ). The marginal distribution p_ Y is given as p(y1,…,yD′)=∫…∫p(y1,…,yD′,z1,…,zD′)dz1…dzD′,p_ Y(y_1,…,y_D )= … p_ X(y_1,…,y_D ,z_1,…,z_D )\,dz_1…dz_D , (3.1) that is, we integrate out or marginalize11 1 Recall that we do not make much difference whether random variables are discrete or continuous and that for discrete random variables we simply replace an integrals in (3.1) by sums. all random variables in Z, in order to get a “reduced model” p_ Y only over random variables Y. We often write (3.1) more compactly as p()=∫p(,),p_ Y( y)= p_ X( y, z)\,d z, (3.2) where we “unpack” the values , y, z as arguments in p(y1,…,yD′,z1,…,zD′)p_ X(y_1,…,y_D ,z_1,…,z_D ) and y as arguments in p(y1,…,yD′)p_ Y(y_1,…,y_D ). While the full joint distribution p_ X captures the dependency structure and uncertainties among all X, the marginal (3.2) accurately describes dependencies and uncertainties among subset Y, while having eliminated Z from consideration. Thus, the marginalization operation (3.2) shall be interpreted as the reasoning primitive ignoring or accounting for unknown quantities Z. Since this happens by integrating or summing over all possible states of the unknown quantity Z, this operation is also often called the sum rule. Basically, it is the law of total probability (see Section 2.4.1) applied to distribution functions. A few things are worth mentioning. First, note that p_ Y is in general a joint distribution, but one over a subset of X. Of course, whenever =Yi Y=\Y_i\ is singleton, p_ Y becomes a univariate distribution pYip_Y_i. The marginal distribution is indeed “the” distribution over Y and not some kind of approximation. Specifically, just as p_ X accurately describes a set of random variables X, p_ Y accurately describes Y, “as if Z had never been considered”. Also the extreme case of marginalization where all variables X are marginalized is interesting, as it delivers the normalization constant or partition function =∫p().Z= p_ X( x)\,d x. (3.3) The normalization constant is important for unnormalized models which represent distribution functions via some nonnegative function f_ X: p()≔f(),=∫f().p_ X( x) f_ X( x) ,~~~~~Z= f_ X( x)\,d x. (3.4) Furthermore note that marginalization is a consistent reasoning pattern, meaning that one always arrives at the same result for any sequence of marginalization operations expressing the same marginal. For example, when starting with a joint p,,p_ X, Y, Z we will arrive at the same marginal p_ X whether we are (i) first marginalizing Z (yielding p,p_ X, Y) and then Y, or (i) first marginalizing Y (yielding p,p_ X, Z) and then Z. 3.2 Conditioning (The Product Rule) Let again a distribution function p_ X for a set of random variables =(X1,…,XD) X=(X_1,…,X_D) be given and let =(Y1,…,YD′) Y=(Y_1,…,Y_D ) and =(Z1,…,ZD′) Z=(Z_1,…,Z_D ) be a partition of X. Given a joint state z for Z, the conditional distribution of Y given z is p|(|)=p(,)p()=p(,)∫p(,),p_ Y| Z( y\,|\, z)=p_ X( y, z) p_ Z( z)=p_ X( y, z) p_ X( y, z)\,d y, (3.5) i.e., the ratio of the joint distribution p_ X and the marginal p_ Z, where the latter is derived from p_ X using the sum rule. The conditional distribution is the concept of conditional probability (see Section 2.4.2) applied to distribution functions. A natural way to interpret p|p_ Y| Z is as a family of distribution functions over Y, indexed by the states ∈ z∈ Z. While the full joint distribution p_ X captures the dependencies and uncertainties among all random variables X, the conditional distribution p|p_ Y| Z describes dependencies and uncertainties among Y upon establishing the event = Z= z. Hence, the conditioning operation (3.5) shall be interpreted as the reasoning primitive observing or injecting evidence (that = Z= z) and updating the distribution over the remaining random variables Y. Equation (3.5) can also be written as p(,)=p|(|)p(),p_ X( y, z)=p_ Y| Z( y\,|\, z)\,p_ Z( z), (3.6) telling us that the joint distribution over Y and Z is given as the product of the marginal distribution over Z and the conditional distribution over Y given Z. This essentially represents a “reasoning step-by-step” pattern: in order to reason about both Y and Z, first reason about only Z and subsequently about Y given Z. Since the joint distribution is given as a product of marginal and conditional distributions, Equation (3.6) is also referred to as the product rule. There are some technical subtleties with conditioning, as in order for (3.5) to be well-defined, the denominator p()p_ Z( z) needs to be non-zero. When Z is discrete, however, we might just assume an arbitrary conditional distribution p|(⋅|)p_ Y| Z(·\,|\, z) whenever p()=0p_ Z( z)=0. To see this note that for any A⊆A Y we have ∫Ap,(,)≤∫p,(,)=p()=0. _Ap_ Y, Z( y, z)\,d y≤ _ Yp_ Y, Z( y, z)\,d y=p_ Z( z)=0. Thus, for any arbitrary p|(⋅|)p_ Y| Z(·\,|\, z) we get ∫Ap,(,)=∫Ap|(|)p()=p()∫Ap|(|)d⏞≤1=0, _Ap_ Y, Z( y, z)\,d y= _Ap_ Y| Z( y\,|\, z)\,p( z)\,d y=p( z)\, _Ap_ Y| Z( y\,|\, z)\,d y^≤ 1=0, as required. When Z is continuous, and hence p_ Z is a density, Equation (3.5) yields a conditional distribution function which is conditional on an event of probability 00. Yet, conditioning is well-defined when the marginal density p()p_ Z( z) is non-zero and continuous at z. Conditioning is, like marginalization, a consistent reasoning operation, meaning that the order of conditioning operations does not matter. For example, when we start with a joint p,,p_ X, Y, Z and want to compute p|,p_ X| Y, Z, we might first condition on Y, yielding p,|p_ X, Z| Y, and subsequently on Z, or, we we condition first on Z and subsequently on Y. To see this, note that the conditional p,|(,|)=p,,(,,)p(),p_ X, Z| Y( x, z\,|\, y)=p_ X, Y, Z( x, y, z) p_ Y( y), specifies a family of joint distribution over X and Z for every value y. Conditioning each of these conditional distributions additionally on Z delivers p,|(,|)p|(|)=p,,(,,)p()p()∫p,,(,,)⏞1/p|(|)=p,,(,,)p,(,)=p|,(|,)p_ X, Z| Y( x, z\,|\, y) p_ Z| Y( z\,|\, y)=p_ X, Y, Z( x, y, z) p_ Y( y) p_ Y( y) p_ X, Y, Z( x, y, z)\,d x^1/p_ Z| Y( z\,|\, y)=p_ X, Y, Z( x, y, z) p_ Y, Z( y, z)=p_ X| Y, Z( x\,|\, y, z) Similarly, by swapping the role of Y and Z, we will get the same result by first condition on Z and then on Y. Conditioning and marginalization are also compatible with each other. For example, when we start with a joint p,,p_ X, Y, Z and want to compute p|p_ X| Z, we might • first condition on Z (yielding p,|p_ X, Y| Z) and then marginalize Y, or • we might first marginalize Y (yielding p,p_ X, Z) and then condition on Z. In general, any two sequences of marginalization and conditioning operations leading to the same marginal and/or conditional will deliver consistent results.22 2 This insight is referring to the exact mathematical definition of marginals and conditionals. When performing approximate inference the results might of course depend strongly on the order of operations due to numerical and other reasons. In fact, a lot of interesting methods in probabilistic inference is based on clever choices of picking such order and beneficial computational techniques. Hence, with the sum and product rule we have established the central “inference machinery” of probabilistic reasoning: we start with a joint distribution p_ X describing our domain of discourse. Then we select variables we want to infer ⊆ Y X, depict variables we know ⊆ Z X, and ignore the rest ∖(∪) X ( Y∪ Z). It is worth to embrace the simplicity and elegance of this calculus, allowing us to (repeatedly) apply just two rules to transform our knowledge base p_ X into the object of desire, p|p_ Y| Z. Before we proceed let us simplify a bit our notation. In particular, we have now introduced symbols like p_ X and p,p_ Y, Z for joint distributions and symbols like p|p_ Z| X and p,|p_ Y, X| Z for conditional distributions. Distinguishing these different marginals and conditionals is essential for our intelligent calculus, but using these subscripts quickly becomes cluttered when, for example, describing the product rule: p(,)=p|(|)p().p_ X( y, z)=p_ Y| Z( y\,|\, z)\,p_ Z( z). These subscripts are redundant, since it is clear from the arguments to which random variables the distribution belongs, and also whether it is a conditional or an unconditional distribution. We might just write more compactly p(,)=p(|)p().p( y, z)=p( y\,|\, z)\,p( z). Hence, we will from now omit subscripts of distribution functions when their nature is clear form the arguments. 3.3 The Chain Rule As mentioned above, the product rule essentially implements a two-step reasoning pattern. By applying the product rule repeatedly, we arrive at the chain rule, which implements a multi-step reasoning pattern. Let X be a set of random variables which is partitioned into sets 1,…,K X_1,…, X_K. In the following, note that it does not matter whether any i X_i, i∈1,…,Ki∈\1,…,K\, contains only a single or several random variables, i.e. the chain rule applies regardless whether we consider single random variables or “blocks” of random variables. Using the product rule repeatedly, we can now write p_ X as p() p( x) =p(1,2,3,4,…,K) =p( x_1, x_2, x_3, x_4,…, x_K) =p(2,3,4,…,K|1)p(1) =p( x_2, x_3, x_4,…, x_K\,|\, x_1)\,p( x_1) =p(3,4,…,K|1,2)p(2|1)p(1) =p( x_3, x_4,…, x_K\,|\, x_1, x_2)\,p( x_2\,|\, x_1)\,p( x_1) =p(4,…,K|1,2,3)p(3|1,2)p(2|1)p(1) =p( x_4,…, x_K\,|\, x_1, x_2, x_3)\,p( x_3\,|\, x_1, x_2)\,p( x_2\,|\, x_1)\,p( x_1) … ~~~~~… =p(K|1,…,K−1)p(K−1|1,…,K−2)…p(3|1,2)p(2|1)p(1) =p( x_K\,|\, x_1,…, x_K-1)p( x_K-1\,|\, x_1,…, x_K-2)\,…\,p( x_3\,|\, x_1, x_2)\,p( x_2\,|\, x_1)\,p( x_1) =∏k=1Kp(k|1,…,k−1). = _k=1^Kp( x_k\,|\, x_1,…, x_k-1). (3.7) In (3.7) the factor p(k|1,…,k−1)p( x_k\,|\, x_1,…, x_k-1) for k=1k=1 shall be interpreted as p(1)p( x_1). This factorization of the joint p_ X is known as the chain rule and represents “step-by-step reasoning” over multiple steps, as it tells us that the joint distribution over 1,…,K X_1,…, X_K is constructed as the marginal over 1 X_1 times the conditional over 2 X_2 given 1 X_1 times the conditional 3 X_3 given 1,2 X_1, X_2, etc. We are not confined to use the chain rule using the ordering 1,2,…,K1,2,…,K, but are free to use any ordering we like. Specifically, for any permutation i1,…,iKi_1,…,i_K of the integers 1,…,K\1,…,K\, we can write p_ X as p()=∏k=1Kp(ik|i1,…,ik−1). p( x)= _k=1^Kp( x_i_k\,|\, x_i_1,…, x_i_k-1). (3.8) For example, we might factorize a joint distribution over 1,2,3 X_1, X_2, X_3 in various ways: p(1,2,3) p( x_1, x_2, x_3) =p(3|2,1)p(1|2)p(2) =p( x_3\,|\, x_2, x_1)\,p( x_1\,|\, x_2)\,p( x_2) =p(2|1,3)p(3|1)p(1) =p( x_2\,|\, x_1, x_3)\,p( x_3\,|\, x_1)\,p( x_1) =p(1|3,2)p(2|3)p(3) =p( x_1\,|\, x_3, x_2)\,p( x_2\,|\, x_3)\,p( x_3) etc. Thus, rather then a single chain rule, for a given partitioning 1,…,K X_1,…, X_K there really exist K!K! different chain rules. The chain rule allows to factor and analyse joint distributions in a flexible way and can be considered as a “Swiss army knife” of probabilistic inference. Conversely, reading the chain rule in the other direction, we can construct expressive joint distributions by providing a marginal or conditional for each k X_k and multiplying these together. Here, the conditionals need to obey some ordering of the k X_k’s, meaning that an k X_k can only appear as conditioned in some conditional distribution pl|…,k,…p_ X_l|…, X_k,… when k X_k comes before l X_l in this order. As long as there exists such an order, the chain rule leads to a proper joint distribution p_ X. This is the main working principle both behind classical Bayesian networks koller2009probabilistic and autoregressive distribution estimators larochelle2011neural. 3.4 Bayes Rule (Law of Inverse Probability) Another consequence of the product rule is Bayes rule or the rule of inverse probability, which has been discussed already in Section 2.4.3 on the level of probability measures. When considering two (sets of) random variables , X, Y, we might write the joint as p(,)=p(|)p()p( x, y)=p( y\,|\, x)\,p( x) or also p(,)=p(|)p().p( x, y)=p( x\,|\, y)\,p( y). By equating the right hand sides and dividing by p()p( x) we yield Bayes rule p(|)=p(|)p()p()=p(|)p()∫p(|)p(),p( y\,|\, x)=p( x\,|\, y)\,p( y) p( x)=p( x\,|\, y)\,p( y) p( x\,|\, y)\,p( y)\,d y, (3.9) which allows us to change the “direction of reasoning” from ← x← y to ← y← x. Bayes rule is in particular prominent in applications were Y is some unobserved (latent) quantity, such as an unknown model parameter, the truth status (true, false) of a hypothesis, or some other (assumed) latent structure underlying an application, while X is an observed quantity (data). In such settings, it is often natural to describe how the data X emerges from the latent quantity Y via some conditional p|p_ X| Y, usually called the likelihood. Together with a marginal distribution p_ Y, usually called the prior, Bayes rule (3.9) allows us to infer the conditional p|p_ Y| X of interest, called the posterior. In this way, Bayes rule captures a wide range of inverse problems in science and engineering. 3.5 (Conditional) Independence The concept of independence discussed in Section 2.4.4 naturally carries over to distributions functions. The conditional distribution p|p_ Y| X represents our information about Y when we have learned the value for X. If this this is the same as when we do not know the value of X, i.e. the marginal p_ Y, we conclude that Y and X are independent. Consequently, we define ⟂ X \!\!\! Y, when the following equivalent conditions hold for all values , x, y: • p(|)=p()p( x\,|\, y)=p( x) • p(|)=p()p( y\,|\, x)=p( y) • p(,)=p()p()p( x, y)=p( x)\,p( y) Independence can occur or disappear in the context of another set of random variables Z. In particular, we say that X and Y are conditionally independent given Z, written ⟂| X \!\!\! Y\,|\, Z, if the following equivalent conditions hold for all values ,, x, y, z: • p(|,)=p(|)p( x\,|\, y, z)=p( x\,|\, z) • p(|,)=p(|)p( y\,|\, x, z)=p( y\,|\, z) • p(,|)=p(|)p(|)p( x, y\,|\, z)=p( x\,|\, z)\,p( y\,|\, z) 3.6 Expectations So far, we have established that probability allows us to represent knowledge in the form of a joint distribution and provides two simple inference rules to process our knowledge, the sum and the product rule. We have also established the chain rule and Bayes rule, which, however, are really just variants of the product rule. All this calculus does is processing distributions into other distributions, as illustrated in the following example. Example 4. Assume we have access to the joint distribution over 2121 random variables Y,X1,…,X20Y,X_1,…,X_20, where Y is some medical parameter of interest (e.g. cerebral blood flow), and X1,…,X20X_1,…,X_20 are some measurements related to Y (e.g. features derived from 2020 EEG channels). Further, assume that for a particular patient we have measured (observed) X1=x1,X2=x2,…X_1=x_1,X_2=x_2,…, but X17X_17 and X19X_19 have not been measured (because for these two the corresponding EEG sensors have dropped out). Hence, employing the sum and product rule we compute p(y|x1,…,x16,x18,x20)=∫p(y,x1,…,x16,x17,x18,x19,x20)dx17dx19∫p(y,x1,…,x16,x17,x18,x19,x20)dx17dx19y,p(y\,|\,x_1,…,x_16,x_18,x_20)= p(y,x_1,…,x_16,x_17,x_18,x_19,x_20)\,dx_17\,dx_19 p(y,x_1,…,x_16,x_17,x_18,x_19,x_20)\,dx_17\,dx_19\,dy, (3.10) which is our inferred distribution about Y, incorporating all available information. In Example 4, one might wonder what shall be done next with pY|X1,…,X16,X18,X20p_Y|X_1,…,X_16,X_18,X_20, a potentially very complicated and multimodal distribution?33 3 The mode of a distribution is the value of y for which p(y)p(y) is maximal. A “bumpy” distribution function which has more than one (local) maxima is called multimodal. Intuitively, multimodality signals ambiguity about Y. How do we get a concrete prediction for Y? The first response to these concerns is that nothing should be done, since the conditional distribution over Y is our concrete prediction. More precisely, if (i) the joint pY,X1,…,X20p_Y,X_1,…,X_20 is indeed the true distribution over all involved quantities, or at least a sufficiently good approximation of it, (i) the observed values x1,…,x16,x18,x20x_1,…,x_16,x_18,x_20 are indeed all the information we have44 4 Note that here we assume that X17X_17 and X19X_19 are missing at random, meaning that the fact that they are missing is independent of Y given the observed RVs rubin1976inference. In this case (3.10) is an exact conditional of Y given the available data. If they were not missing at random, one would need to account for this fact, for example by explicitly incorporating the missingness process in the model. and (i) (3.10) is solved exactly, there is nothing more that we can do. The conditional pY|X1,…,X16,X18,X20p_Y|X_1,…,X_16,X_18,X_20 captures everything we can know about Y based on the available information, or actually, it captures what we don’t know, namely our uncertainty about Y. If the distribution is unimodal and very concentrated we are pretty confident about the value of Y, while if it is spread out and multimodal we are pretty uncertain. Keeping the whole distribution of Y means that we know what we don’t know. However, humans tend to be uncomfortable with this situation. They want to call the shots and know a concrete single value for Y. Often, committing to a single value is also an external requirement, forcing us to make a decision. The basic tool to do so is expectation, which is simply the average value a random variable assumes: [X]≔∫p(x)xx, E[X] p(x)x\,dx, (3.11) where the integral is taken over the state space of X. For discrete random variables, the integral is replaced by a sum. For random vectors the expectation is a vector-valued quantity: []≔∫p(). E[ X] p( x) x\,d x. (3.12) Expectations can be naturally applied to conditional distributions. When p|p_ Y| Z is a conditional distribution, the conditional expectation of Y given the event = Z= z is [|]=∫p(|). E[ Y\,|\, z]= p( y\,|\, z)\, y\,d y. (3.13) In Example 4, computing [Y|x1,…,x16,x18,x20] E[Y\,|\,x_1,…,x_16,x_18,x_20] is one particular way to decide a value for Y. However, being an average does not necessarily make it a typical value of the distribution, as illustrated in Example 5. Example 5 (Expectation of a Bernoulli). Consider a Bernoulli distribution over a random variable X with state space =0,1X=\0,1\, assigning probabilities pX(1)=θp_X(1)=θ and pX(0)=1−θp_X(0)=1-θ, where θ is a single parameter called the success probability. When θ=0.5θ=0.5, the expectation is [X]=0.5 E[X]=0.5 which is a value never assumed by X. Generally, one can easily construct multimodal distributions for which the expectation might lie somewhere between the modes in an arbitrary large area of 00 probability. As the expectation is describing some aspect of the distribution over X, an immediate idea is to also consider expectations of transformations of X. In particular, for some (measurable) function g and we might define =g() Y=g( X). Then, the expectation of [] E[ Y] will also be describing aspects of the original distribution p_ X. Computing [] E[ Y] in principle requires that we first figure out p_ Y, which is often a delicate task. However, there is another and often simpler way, as it holds that [g()]=[]=∫p()=∫p()g(). E[g( X)]= E[ Y]= p( y) y\,d y= p( x)g( x)\,d x. (3.14) This identity is known as the law of the unconscious statistician (LOTUS), as the right hand side is often considered as a definition of E[g()]E[g( X)], even though it is actually a theorem. For univariate random variables, a common choice for g are powers, i.e. g(x)=xKg(x)=x^K, where k∈ℕk , and the expectation [Xk] E[X^k] is called the kkth moment of pXp_X. The first moment is of course just the expectation [X] E[X] also called the mean of pXp_X. The second moment of a transformed version of X, centered at 0 by subtracting its mean, is the variance [X]≔[(X−[X])2]=[X2]−[X]2. V[X] E[(X- E[X])^2]= E[X^2]- E[X]^2. (3.15) For random vectors X, the corresponding concept is the covariance matrix: Cov[]≔[(−[X])T(−[X])]=[T]−[]T[].Cov[ X] E[( X- E[X])^T( X- E[X])]= E[ X^T X]- E[ X]^T E[ X]. (3.16) The diagonal of CovCov are the variances of the individual random variables in X, while the off-diagonal contains the covariances between any pair X,Y∈,X≠YX,Y∈ X,X =Y: Cov[X,Y]=[(X−[X])(Y−[Y])].Cov[X,Y]= E [(X- E[X])\,(Y- E[Y]) ]. (3.17) In summary, expectations are one of the main tool to convert probability distributions into “concrete values”. This concept becomes in particular important when paired with optimization (taking maxima or minima), leading to decision making, see Section 3.8. 3.7 Most Probable Explanation Rather than averaging we might also take the extreme values, i.e. maxima or minima. In particular, when p is a joint distribution over random variables =(X1,…,XD) X=(X_1,…,X_D) with state space X, then we might ask which state is the most likely one, i.e. the state with maximal probability: ∗=argmax∈p() x^*= _ x∈ Xp( x) (3.18) Here we assume the maximum is unique. If it is not, we might either break ties in some way or return the set of all maxima. The value ∗ x^* is known as most probable explanation (MPE) pearl1988probabilistic. The MPE is particularly interesting for conditional distributions. Referring to Example 4, the MPE for Y given the observed information would be y∗=argmaxyp(y|x1,…,x16,x18,x20)y^*= _yp(y\,|\,x_1,…,x_16,x_18,x_20) (3.19) If Y is a discrete random variable, and hence the conditional distribution function is a PMF, y∗y^* is indeed the most probable value for Y for the given evidence. Example 6 (MPE with Densities). Assume that Y has the following density pY(y)=0.999pN(y|−10,2)+0.001pN(y| 9,0.0005),p_Y(y)=0.999p_N(y\,|\,-10,2)+0.001p_N(y\,|\,9,0.0005), where pN(y|μ,σ)=12πσ2e−(x−μ)22σ2p_N(y\,|\,μ,σ)=1 2πσ^2e^-(x-μ)^2 2σ^2 is the Gaussian density. Hence, p(y)p(y) is a Gaussian mixture with two components, one of which represents 0.9990.999 of the total probability mass and the other 0.0010.001. This density is shown in the following figure: Here we omit any conditioning information, but we might figure pYp_Y as a (toy) distribution resulting from (3.10) in Example 4. The MPE in this example, i.e. the state where pYp_Y is maximal, is y∗=9y^*=9, or actually slightly less, due to the Gaussian component on the left. When Y is continuous, and hence the conditional is a density, the interpretation of y∗y^* is a bit more subtle, as illustrated in Example 6. The MPE in this example is perhaps surprising, as the value Y=9Y=9 maximizes the density pY(9)≈0.8p_Y(9)≈ 0.8, but is located in a region attributing only about 0.1%0.1\% of the total probability mass. If we were to pick the other mode around Y=−10Y=-10, we would get a smaller value for pY(−10)≈0.2p_Y(-10)≈ 0.2 but be in a region accounting for 99.9%99.9\% of the probability. Is MPE flawed for densities? No, the seeming paradox comes from making tacit assumptions. MPE makes the following promise: assuming that pYp_Y is continuous, then there exists some ϵ>0ε>0 such that the probability that Y falls into the interval [y∗−ϵ,y∗+ϵ][y^*-ε,y^*+ε] is maximal when y∗y^* is the MPE. In Example 6, if we discretize the state space of Y into very small cells and bet on the outcome in which cell Y will land, we are best off by committing to the MPE at y∗=9y^*=9 (for small enough cell size). This might often not be what we want for real-valued state spaces. The solution to such apparent paradoxes is offered by decision theory. 3.8 Decision Theory The issue with Example 6 is that many would prefer the mode of the left Gaussian, since with 99.9%99.9\% probability Y takes a value in the vicinity of −10-10. Intuitively, if we guess Y=−10Y=-10 but the true value turns out to be, say, Y=−10.13Y=-10.13, we still would be happy, since we have guessed a value close to the true value. As illustrated above, MPE essentially discretizes the space into tiny cells and deliberately ignores any notion of closeness among the cells—if we bet on the neighboring cell of where Y really lands, “we still lose” according to MPE. Decision theory berger1990statistical allows us to make such assumptions explicit, by introducing a loss function and a simple recipe for making optimal decisions under uncertainty. Assume we aim to decide on the value of a scalar quantity of interest Y (the case for random vectors is straightforward), and let Y be the state space of Y. In order to make this decision we assume that we have evidence = X= x, and that we have already computed the conditional pY|p_Y| X, by applying the sum and product rule. If no evidence is available, we would use the marginal pYp_Y instead. In either case, we arrive at the required distribution by mere application of the sum and product rules. A loss function ℓ is any function ℓ:×↦ℝ. ×Y . (3.20) Given y∗,yt∈y^*,y_t , the value ℓ(y∗,yt) (y^*,y_t) represents our regret when we decide for value y∗y^*, but actually Y=ytY=y_t. Usually, loss functions will satisfy ℓ(yt,yt)≤ℓ(y∗,yt) (y_t,y_t)≤ (y^*,y_t) for all y∗∈y^* , that is, our loss will be minimal if we correctly guess the true value of Y. Now, the basic rule of decision theory is to decide for the value which minimizes the expected loss, conditional on the available evidence = X= x: y∗=argminy∈[ℓ(y,Y)|].y^*= _y ~ E[ (y,Y)\,|\, x]. (3.21) The frequentist interpretation of probability gives a clear argument why this is an optimal decision rule: in a scenario of making repeated decisions, rule 3.21 will lead to the minimal sum of losses if we correctly inferred the true pY|p_Y| X and the number of decision trials goes to infinity. Let us study a few basic loss functions in the context of Example 6. Zero-one loss. Consider for some ϵ>0ε>0 the loss function ℓ0/1(y∗,y)=0if |y∗−y|<ϵ1otherwise, _0/1(y^*,y)= cases0&if |y^*-y|<ε\\ 1&otherwise, cases denoted as zero-one loss. If the (conditional) density of Y is continuous, then (3.21) under zero-one loss approaches the MPE when ϵ→0ε→ 0. Hence MPE essentially minimizes zero-one loss. Squared distance loss (ℓ2 _2-loss). The “all-or-nothing” behavior of MPE is probably not what one wants in Example 6, as it delivers an “atypical” value in an area of low probability. Rather, one would probably prefer the squared distance loss ℓ2(y∗,y)=(y∗−y)2, _2(y^*,y)=(y^*-y)^2, as it assumes that we are still happy if we guess a values close to the true value of Y. It can be shown that for any distribution pYp_Y, the least squares loss, i.e. (3.21) when using ℓ2 _2, is achieved by the mean of pYp_Y. For a Gaussian mixture model the mean is given as the corresponding mixture of the components’ means. Specifically, in Example 6, we get the solution y∗=0.999×(−10)+0.001×9=−9.981,y^*=0.999×(-10)+0.001× 9=-9.981, (3.22) delivering a value almost at the center of the high probability region on the left. Absolute distance loss (ℓ1 _1-loss). However, one might be concerned by the fact that the least squares solution (3.22) is quite influenced by the locations of the Gaussian components. In particular, if the mean of the right Gaussian component (the one with weight 0.0010.001) was moved to a very large value, e.g. 90009000, we would get y∗=−0.99y^*=-0.99 which is far away from the high probability area. This proneness to outliers is typical for least squares. A remedy to this problem is to use absolute distance loss defined as ℓ1(y∗,y)=|y∗−y|. _1(y^*,y)=|y^*-y|. It can be shown that the minimum of (3.21) when using ℓ1 _1 is achieved by the median of pYp_Y, which is the value y∗y^* for which ℙ(Y≤y∗)=ℙ(Y≥y∗)=0.5 P(Y≤ y^*)= P(Y≥ y^*)=0.5. It can be figured out that the median in Example 6 is about −9.9975-9.9975 and it stays virtually the same if we move the mean of the right Gaussian to 90009000 or even far more extreme values. This robustness to outliers is a well known property of ℓ1 _1-loss and the median. In summary, minimizing expected loss (3.21) is a principled approach to “call the shots” and transit from our probabilistic prediction—a conditional distribution over the quantity of interest Y—to a concrete hard value y∗y^*. It should be advised that—in the ideal setting—this step should come very last, since it discards all the beautiful “fluffy uncertainty” about Y and approximates it with a brutally hard single value. In particular in Example 4, figure the scenario that inferring the cerebral blood flow Y was only an intermediate step, and that the ultimate goal is to infer, together with other medical parameters, the health condition of a patient. In this scenario it is crucial to keep the entire p(y|…)p(y\,|\,…) and process it further downstream. Approximating it in any way before we have arrived at the final inference goal compromises the exact reasoning calculus of probability, destroys valuable information, and can---in principle---deliver arbitrary bad results. In other words, we shall ‘stay calm’ and continue applying the sum and product rule.55 5 A typical criticism raised at this point is that probabilistic modeling and inference are hard, and that all the required approximations along the way might be much worse than replacing intermediate distributions with concrete values. This is certainly a valid point, but conflates two aspects: one aspect, which is the central one in this thesis, is asking what in principle should be done, i.e. what is in principle an optimal calculus of reasoning under uncertainty? The other aspect is what can be done in reality and how well our optimal calculus can actually be implemented. Some points are worth mentioning. First, defining a loss function ℓ and applying decision rule (3.21) makes our assumptions explicit and allows us to specify about what we care when deciding a value y∗y^*. However, designing a loss function for a concrete application is not trivial. For example, when we are dealing with a binary classification problem, i.e. Y∈0,1Y∈\0,1\, where Y=0Y=0 represents the absence of a deadly disease and Y=1Y=1 represents its presence, it is quite delicate to come up with good loss function. It is clear, that predicting y∗=0y^*=0 (patient healthy) when in fact Y=1Y=1 (patient ill) should incur a higher loss than for the converse case. But, how much higher? We might fix an arbitrary price, e.g. 11 Euro, to diagnosing the patient as ill when in fact they are healthy, but how much does it cost when we release an actually ill patient and endanger their live? An ethically delicate question. Yet, I want to stress again that if (i) the loss function ℓ indeed adequately represents our preferences, (i) we have access to the true data generating distribution pY,p_Y, X and (i) we can actually compute (3.21) exactly, there is nothing left to do—we have successfully made an optimal decision in terms of expected loss. There are a lot of “if’s” here and I am not saying that these computations are easy, yet it is surely beneficial to know and specify what is the best one can do. For example, in the case of classification, the MPE computed for the true data distribution leads to the Bayes optimal classifier, i.e. the classifier with minimal zero-one loss. A famous result for the K-nearest neighbor classifier is that it asymptotically converges to the Bayes optimal classifier (given that the number of neighbors grows also to infinity, but less strongly than the number of data points), making it a theoretically well-justified classification rule bishop2006pattern. In the context of regression, using the data generating distribution and ℓ2 _2 loss leads to the optimal regression function, and no ever-so-fancy machine learning method will be able to outperform it in terms of true squared loss. Finally, it is worth mentioning that (3.21) is not the only good decision rule. For example, we might not care about the expected loss too much but rather predict a value such that the suffered loss is smaller than a certain threshold with a prescribed probability, and otherwise reject the decision, leading to a more risk aware prediction scheme. Moreover, conformal prediction shafer2008tutorial gives up on the property to return only a single value but rather returns a minimal set of predictions ∗⊂Y^* such that the true value of Y ends up in in ∗Y^* with high probability. Chapter 4 State of The Art In this chapter, I provide an overview of state-of-the-art probabilistic approaches in AI. While AI was largely dominated by logic-based methods until the late 1980s, the necessity of accounting for uncertainty in real-world scenarios became increasingly recognized. Although probability was not immediately embraced—it actually faced quite some criticism for its computational challenges and perceived impracticality—it gradually gained ground. A key proponent was Judea Pearl, whose seminal book Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference pearl1988probabilistic firmly established probabilistic reasoning as a central approach in AI. Graphical Models, in particular Bayesian networks, were central to Pearl’s work and have since remained a cornerstone of probabilistic modeling koller2009probabilistic. Although their prominence has somewhat diminished in the deep learning era, they still serve as a lingua franca of probabilistic modeling, due to their intuitive visual representation, which correspond directly with conditional independence assumptions and tractability in inference and learning pearl1988probabilistic; koller2009probabilistic. Inference in graphical models—especially marginalization via the sum rule—is generally NP-hard cooper1990computational. However, exact inference is tractable for models with bounded treewidth, a measure of how tree-like a graph is. Most probabilistic machine learning systems can be mapped onto a corresponding graphical model, and authors often use such them to concisely express model structure and assumptions. Deep Autoregressive Models larochelle2011neural; van2016conditional apply the chain rule of probability and model each conditional distribution using a shared neural network. These models can be interpreted as fully connected Bayesian networks, which are capable, in principle, of representing any joint distribution. While they support sampling and density evaluation, computing marginals, conditionals, or performing complex inference tasks remains challenging. Variational Autoencoders (VAEs) kingma2019introduction are a neural latent variable model, previously known as density models mackay1995bayesian. They introduce a latent code with a simple distribution, often isotropic Gaussian, which is transformed by a neural network to produce the (parameters of) a conditional distribution over observable variables; hence they represent an infinite mixture model, with the latent variable marginalized out. Exact inference in VAEs (density networks) is a hard task, but the evidence lower bound (ELBO), that is, a lower bound on the log-likelihood can be estimated. A major innovation of VAEs was the introduction of amortized inference: instead of computing the posterior for each data point individually, a separate network—commonly called the encoder or inference network—learns to approximate it. The encoder is used to compute an ELBO estimate which used as the VAEs learning objective as a replacement for the exact log-likelihood. By optimizing both the parameters of the model and the encoder, one achieves the dual goal to improve the ELBO estimate and optimizing the model parameters at the same time. Generative Adversarial Networks (GANs) goodfellow2014generative also introduce a simple latent distribution but adopt an adversarial training scheme rather than maximizing a log-likelihood bound. They involve a second network—the discriminator or critic—which learns to distinguish real data from generated samples. This training objective corresponds to minimizing a probabilistic divergence distinct from maximum likelihood goodfellow2014generative; arjovsky2017wasserstein. While GANs enable realistic sampling, they generally do not allow density evaluation (often such densities do not exist in the Lebesgue sense), nor do they support tractable inference for marginals or conditionals. Normalizing Flows rezende2015variational; papamakarios2021normalizing are another principle to probabilistic modeling. Similar as VAEs and GANs, they start with a simple distribution (e.g., an isotropic Gaussian) and apply a series of bijective, differentiable transformations to generate samples from a more complex target distribution. The exact density of the transformed distribution is computed via the change of variables formula, and exact sampling is also feasible. However, computing marginals or conditionals remains challenging, similar to VAEs and GANs. Energy-Based Models define distributions using an unnormalized energy function E()E(x), often parameterized by a neural network: p()=exp(−E())∫exp(−E()).p(x)= (-E(x)) (-E(x))dx. While extremely flexible, these models are typically intractable. Evaluating densities, drawing samples, and performing inference are all computationally expensive. Marginals and conditionals are especially difficult to estimate reliably. Score-Based Models vincent2011connection are closely related to energy-based models and represent a distribution via its score function, i.e., the gradient of the log-density, ∇logp()∇ p(x). A neural network is trained to approximate this score. When combined with diffusion processes and Langevin dynamics, these models currently represent the state of the art in generative modeling for images song2020score. Despite their impressive performance, score-based models usually lack tractable density evaluation and require approximations for sampling, marginals, and conditionals. These approximations can be difficult to validate in practice. Gaussian Processes (GPs) williams2006gaussian are another prominent type of probabilistic model. Formally, GPs are a (possibly uncountable) collection of random variables, of which any finite subset has a multivariate Gaussian distribution. Usually, these random variables are indexed by some continuous parameter, e.g. x∈ℝx , which allows us to interpret GPs as random functions. GPs have ample applications in Bayesian modeling of latent functions and Bayesian optimization snoek2012practical. Due to Gaussianity, computing marginals and conditionals in GPs is tractable, but associated with a cubic computational cost in the number of data points, which becomes delicate for large data sets. These challenges are most commonly addressed with sparse inducing point techniques quinonero2005unifying. Probabilistic Programming (P) van2018introduction is a general framework to express probabilistic models in a flexible way, namely by writing a program equipped with random variables. When evaluating such a program in the standard way, it simply amounts to a stochastic simulator. However, the main powerful idea of P is that such a program constitutes a probabilistic model which can be subject to inference. In this way, one might provide data for the observed output of a probabilistic program and query the posterior distribution over certain latent parameters, in principle inferred via Bayes’ rule. In practice, this inference is tackled via approximation, usually employing variational inference or Monte Carlo techniques. In a nutshell, P aims to achieve for probabilistic modeling and inference what machine learning frameworks like TensorFlow and PyTorch have achieved for deep learning. The list of probabilistic modeling approaches above is not complete, but captures a coarse picture of ‘what is going on in the field’. A remarkable point is that many models mainly strive for expressivity and neglect the question about inference, or actually, heavily rely on approximation such as sampling and variational inference.11 1 The most noteworthy exceptions are low-tree width graphical models and GPs. This is in quite stark contrast to the picture of probability as a sound and rigorous reasoning framework under uncertainty. Reasons for this neglect are, in my personal opinion, stemming from a particular mindset (i) assuming that tractable models necessarily underperform and (i) tailored towards the contemporary success of deep learning (i.e. function approximation) style of AI. Probabilistic circuits, as discussed in the following, put an explicit focus on tractability. Chapter 5 Probabilistic Circuits So far, I have presented probability as an elegant and rigorous inference language for AI, boiling down to two simple rules, the sum and product rule. Then, in order to make (optimal) decisions, all we need to do on top of that is taking expectations, maxima and minima. Of course, this actually requires us that we have access to the true underlying data distribution or a reasonably good approximation. If our model defers too much from reality, all the inferences we are doing will be worthless—garbage in, garbage out. Hence, faithful modeling and learning is a crucial part of the game. Probabilistic models are generally some representation of a distribution function p_ X, such as probabilistic graphical models (PGMs) koller2009probabilistic, density networks and variational autoencoders (DNs, VAEs) mackay1995bayesian; kingma2019introduction; rezende2014stochastic, neural auto-regressive distribution estimators (NADEs) larochelle2011neural, energy-based models song2021train, score-based models vincent2011connection, normalizing flows rezende2015variational, probabilistic programs bingham2019pyro, and Gaussian processes (GPs) williams2006gaussian.11 1 GPs are technically a collection of (infinitely many) random variables with the property that any finite dimensional marginal is Gaussian. Hence, the distribution function of any finite subset of random variables is defined. A common model which does not represent a distribution function p_ X (yet a distribution ℙ P_ X) is generative adversarial networks (GANs) goodfellow2014generative, as they usually do not admit a density with respect to Lebesgue measure. All these models represent distributions in various creative and flexible ways, so that we are hopefully able to represent and learn the distribution we are interested in in. Probabilistic inference, however, is generally intractable in most of these models. Exceptions are PGMs with bounded tree-width koller2009probabilistic (computing marginals is exponential in the tree-width) and GPs (computing conditionals is cubic in the number of samples). For all other models, computing marginals and/or conditionals is a hard computational problem, as they are all based on high-dimensional non-linear functions (neural networks). Computing integrals—the core business of inference—over such functions is a notoriously hard task. Probabilistic circuits (PCs vergari2020probabilistic; choi2020probabilistic are a type of tractable probabilistic model that allows to perform inference exactly and efficiently, meaning that the probabilistic inference task of choice (marginals, conditionals, etc.) are computable without approximation22 2 Leaving aside numerical errors stemming from finite precision arithmetic. and in polynomial time of the PC’s size. Hence, PCs stay at all times faithful to the probabilistic reasoning principle: when we manage to represent our distribution of interest as a PC, we do have the guarantee that we arrive at the correct conclusion. This property makes PCs quite unique among other probabilistic models, which typically strive for maximal expressivity rather than tractable inference. Evidently, there must be a catch to PCs. Basically, PCs “buy” tractability by accepting rather stringent constraints on (or properties of) their structure. These constraints make them less expressive than other types of model, meaning that there exist probability distributions which have a compact representation (polynomial in the number of random variables) as, say, a PGM, but an exponential representation size as a PC. These theoretical arguments, which go under the name expressive efficiency martens2014expressive, are however not fully conclusive. In particular, the PC community has steadily been making progress over the last two decades and demonstrated that tractable models often compete well with intractable ones or even outperform them. Some examples are provided in Part I of this thesis.33 3 For more examples, see e.g. our latest tutorial at NeurIPS’22 vergari2022probabilistic. Furthermore, it should be noted that PCs are still universal approximators of densities, that is, they absolutely can represent any distribution we like. The representation size, however, might just be infeasible. The term “probabilistic circuits” is a relatively new one, but the principle has been around since decades and is known under many different names. Arithmetic circuits darwiche2003differential are probably the earliest representatives and clearly display the key ideas of PCs and other tractable circuits (operating e.g. in the logic domain). The concept of PCs is also reflected in AND/OR-graphs dechter2007and, sum-product networks poon2011sum and many other models. The main idea to use yet another name, put forward by several researchers at UCLA choi2020probabilistic, is to unify these superficially different names and concepts under one umbrella. In this chapter, I introduce PC and explain their working principles. Furthermore, I give an overview of the work I have done in this area over the last 10 years, which also concludes Part I of this cumulative Habilitation thesis. In Part I, the relevant papers I have published are listed as chapters. 5.1 Basic Definitions of Probabilistic Circuits We start with the formal definition of PCs. Definition 12 (Probabilistic Circuit (PC)). Let a collection of random variables =(X1,…,XD) X=(X_1,…,X_D) be given, let 1,…,DX_1,…,X_D be their state spaces and =×⟩ X= _iX_i the joint state space of X. A probabilistic circuit (PC) is a representation (model) of a potentially unnormalized joint probability distribution defined on X, i.e., a function p:↦[′,∞].p X [0,∞]. (5.1) Specifically, a PC is a type of neural network, i.e. a (directed acyclic) computational graph =(V,E)G=(V,E) containing three types of computational nodes, namely probability distribution functions (short distributions), weighted sums and products. In the following we introduce the symbols D, S and P to refer to some generic distribution, sum and product node, respectively, while N refers to a generic node of any type. Further, let D, S and P denote the set of all distributions, sums and products, respectively. For any ∈V N∈ V, let ()in( N) denote the neighbors of N with an edge towards N, and ()out( N) be the neighbors with an edge outgoing from N. The input to the PC is some state =(x1,…,xD)∈ x=(x_1,…,x_D)∈ X for the random variables ( x is not contained in V). The leaves of G are the distribution nodes, i.e., =∈V|()=∅ D=\ N∈ V\,|\,in( N)= \, while all other nodes are either sum or product nodes. Moreover, only the distribution nodes get x as direct input (and by construction no input from any ∈V N∈ V), while sum and product nodes can only get direct input from nodes in V. Thus, the distribution nodes D form the first layer in the PC, while sums and products are located on “higher” layers. For that reason, distribution nodes are also often called input distributions of the PC. A distribution node D is a distribution function over some subset of X. This subset, written as []⊆ X[ D] X, is denoted as the scope or receptive field of D. Hence, when evaluating the PC for some joint state x, node D only receives [] x[ D], defined as the vector containing the values in x corresponding to [] X[ D]. The value computed by D is the distribution function evaluated at [] x[ D], which is technically ([]) D( x[ D]), but usually written simply as () D( x). A distribution node might have trainable parameters, which are denoted as θ_ D. A sum node S with real weights =(θ)∈() θ_ S=( _ S N)_ N ( S) computes a nonnegative mixture of its inputs, i.e., ()=∑∈()θ() S( x)= _ N ( S) _ S N\, N( x) (5.2) where θ _ S N are (trainable) weights satisfying θ≥0 _ S N≥ 0. A product node P computes the product of its inputs, i.e., ()=∏∈()(). P( x)= _ N ( P) N( x). (5.3) Note since distribution nodes have a restricted scope, that is, a subset of X, sum and product nodes will also have a restricted scope. For an arbitrary sum or product node N, its scope is recursively given as []=⋃′∈()[′]. X[ N]= _ N ( N) X[ N ]. (5.4) The nodes with ()=∅out( N)= are called the roots or output nodes of the PC. We assume that the roots have full scope, i.e., []= X[ N]= X. Usually, we assume that the PC has a single root, representing the model (5.1). Example 7 (Probabilistic Circuit). An example PC over seven random variables X1,…,X7X_1,…,X_7 is shown on the right. A complete state (observation) =(x1,…,x7) x=(x_1,…,x_7) serves as input to the PC. The first layer consists of distributions nodes ( D’s), here illustrated with nodes showing a Gaussian-like distribution functions (they are, however, not necessarily Gaussian, but any distribution function can be used). The scope of each distribution node can be recognized by which input values are connected to it. The nodes with ++ and × symbols are the sum and product nodes, respectively. The PC computes a density by evaluating the circuit bottom up, as usual in neural networks. The return value is p()p( x), the PC distribution evaluated at x. Paramters for sum weights and distribution nodes are not shown in the figure. We see that the definition of PCs is quite straightforward: We aim to represent a multivariate distribution function p:↦[′,∞]p X [0,∞] and do this with a neural network whose first layer consists of distribution functions over smaller scopes, and whose higher layers contains nonnegatively weighted sums and products. Since the distribution nodes are nonnegative and the sum weights are nonnegative, the whole function will be nonnegative. Of course, PCs according to Definition 12 might not be normalized, hence they define a distribution function up to the normalization constant =∫p(),Z= p( x)\,d x, (5.5) which we assume to be finite and non-zero. An example of a PC is shown on Example 7. 5.1.1 Decomposability and Smoothness The central motivation of PCs is that probabilistic inference remains tractable, i.e., so at least we should be able to compute marginals and conditionals. However, PCs according to Definition 12 are actually intractable. In particular, the normalization constant (5.5) and any other marginals will be pretty hard to compute. We are still missing some “secret sauce” for tractability, namely, structural constraints. The two most important structural constrains used in PCs are decomposability and smoothness. Definition 13 (Decomposability). A product node P in a PC is called decomposable if its input nodes have disjoint scopes, i.e., ∀,′∈(),≠′:[]∩[′]=∅.∀ N, N ( P), N = N X[ N]∩ X[ N ]= . A PC is decomposable if all its product nodes are decomposable. Definition 14 (Smoothness). A sum node S in a PC is called smooth if all its input nodes have the same scope, i.e., ∀,′∈():[]=[′].∀ N, N ( S) X[ N]= X[ N ]. Note that by (5.4) a smooth sum node has the same scope as any of its input nodes. A PC is smooth if all its sum nodes are smooth. Note that the PC in Example 7 is decomposable and smooth. Smoothness is a bit of a cosmetic property, as a non-smooth PC can either be rendered smooth or it turns out that the normalization constant is ∞, hence the PC is not a valid representation of a distribution. Hence, for now we can just safely assume that any PC is smooth. Decomposability will turn out to be a key property for tractable inference, in particular marginals and conditionals. But first let us better understand what these two structural properties imply. 5.1.2 PCs as Hierarchical Mixtures An immediate and convenient consequence of decomposability and smoothness is that the normalization constant of a PC is 11 if we (i) use normalized input distributions (i.e. their normalization constant is 11) and (i) use normalized sum weights, i.e., for each S, additionally to requiring θ≥0 _ S N≥ 0 we also require ∑∈()θ=1 _ N ( S) _ S N=1, so that S computes a convex combination of its inputs. More precisely, it will turn out that each node in a PC is a normalized distribution over its scope and that the whole PC just forms a hierarchical mixture model. We show this property by induction over a topological order of the PC nodes V. Since the computational graph is acyclic and directed, there exists at least one topological order of the nodes 1≺2≺⋯≺|V|, N_1 N_2 … N_|V|, (5.6) such that it holds for each i N_i that all nodes in (i)in( N_i) have an index smaller than i. In other words, order (5.6) is a topological order if arrows can only point from “left to right”. The existence of at least one topological order is equivalent to the fact that the PC graph G is directed and acyclic. We can assume that the input distributions are the first ||| D| nodes in this order. Since we assume that they are already properly normalized distributions, their normalization constant is 11. This is the induction basis. Next assume any node i N_i with i>||i>| D|, which is either a sum or product node. We assume, by induction, that all nodes 1,…,i−1 N_1,…, N_i-1 have normalization constant 11 and show that in this case also i N_i has normalization constant 11. First note that all (i)in( N_i) come before i N_i in the order and have therefore a normalization constant of 11. Assume first that i= N_i= P is a product. For simplicity, we assume that P has only two inputs N and ′ N . The case for more inputs is immediate. Further, let us rename the scopes of the two input nodes as []= X[ N]= Y and [′]= X[ N ]= Z and recall that decomposability means that ∩=∅ Y∩ Z= . Then the product computes ()=()′(). P( x)= N( y)\, N ( z). (5.7) Hence, since N and ′ N are correctly normalized distributions, P is just a factorized distribution, assuming independence among Y and Z, see Section 3.5. In particular, its normalization constant is 11 since ∫()=∫()′()=(∫()d)⏞=1(∫′()d)⏞=1=1. P( x)\,d y\,d z= N( y)\, N ( z)\,d y\,d z= ( N( y)\,d y )^=1\, ( N ( z)\,d z )^=1=1. (5.8) If, on the other hand, i N_i is a sum node, it computes ()=∑∈()θ(). S( x)= _ N ( S) _ S N N( x). (5.9) Since by induction hypothesis all ()in( S) are correctly normalized distributions, and since the weights satisfy θ≥0 _ S N≥ 0 and ∑∈()θ=1 _ N ( S) _ S N=1 and the sum node is smooth, (5.9) is just a mixture distribution, i.e. a convex combination of distribution functions. This in turn is always a correctly normalized distribution. In particular, when we compute the normalization constant, we see that ∫()=∫∑∈()θ()=∑∈()θ∫()d⏞=1=∑∈()θ=1. S( x)\,d x= _ N ( S) _ S N N( x)\,d x= _ N ( S) _ S N N( x)\,d x^=1= _ N ( S) _ S N=1. (5.10) Consequently, any node in a decomposable and smooth PC is a correctly normalized distribution over its scope, either by construction ( D), or because it is a factorized distribution ( P) or a mixture distribution ( S), whose factors (respectively mixture components) are given by other PC nodes. We can figure that a PC structure is just a blueprint, crafting larger distributions out of smaller ones, like Lego blocks. An important thing to note is that, even though products represent factorized distributions and hence independence between the scopes of their input nodes, the overall PC distribution does not show these independence properties. This fact stems from the mixture nodes, as a mixture of factorized distributions does (usually) not factorize. One extreme example are Gaussian mixtures44 4 Note that a Gaussian mixture models are just a special case of PC with a single sum node, whose input distributions are all Gaussian. whose Gaussian components have diagonal covariance matrices and hence factorize into univariate Gaussians. Even these models are known to be universal approximators of arbitrary densities, even though each of their components are individually assuming complete independence among all random variables. Decomposability and smoothness together with normalized sum weights yield a very nice interpretation of PCs as a hierarchical mixture model. However, an immediate question is whether we loose something when assuming normalized sum weights: Are PCs with unnormalized weights more powerful, i.e., can we represent more distributions with it? The answer to this question is negative peharz2015theoretical: Any decomposable and smooth PC with unnormalized weights can be converted into a PC with identical structure but normalized weights, while representing the exact same distribution. As a warning, this procedure is not simply renormalizing the sum weights, at least not independently. Rather, it performs a bottom up sweep over the PC, and normalizes them in turn while compensating the scaling it does to higher nodes. At any rate, however, this result gives us license to always assume that sum weights are normalized, without sacrificing any modeling power. 5.2 Marginalization The most important consequence of decomposability and smoothness is that PCs allow to compute any marginal distribution in linear time of the network size, i.e. the number of edges |E||E|. In order for this to hold true we require that the input distributions D are themselves tractable, i.e. that they allow to compute any marginal. A decomposable and smooth PC will basically “inherit” this tractability from its input distributions. One way to ensure this is to use only one-dimensional distributions as input nodes, as marginalizing a single variable will simply deliver the constant 11. Another common choice is to use multivariate Gaussian, parametrized with a D-dimensional mean vector μ and a D×D× D positive definite covariance matrix C: pGauss(|,)=1(2π)D||exp(−12(−)T−1(−)).p_Gauss( x\,|\, μ, C)=1 (2π)^D| C| (-1 2( x- μ)^T C^-1( x- μ) ). (5.11) It is a well-known fact that marginals of multivariate Gaussians are again Gaussian. Moreover, these marginals are obtained by simply discarding the entries in μ and C corresponding to marginalized random variables. As we have seen in the last section, sum and product nodes in decomposable and smooth PCs are simply mixtures and factorized distributions of other distributions computed in the PCs. The mechanism for tractable marginalization is that mixtures and factorizations allow to “delegate” marginalization to their mixture components and factors, respectively. In particular, let S be an arbitrary sum node in a decomposable and smooth PC, computing the mixture distribution ()=∑∈()θ(). S( x)= _ N ( S) _ S N N( x). Assume we want to marginalize ⊆ Z X and let =∖ Y= X Z. It holds that () S( y) =∫∑∈()θ(,) = _ N ( S) _ S N\, N( y, z)\,d z =∑∈()θ∫(,) = _ N ( S) _ S N N( y, z)\,d z =∑∈()θ(), = _ N ( S) _ S N\, N( y), meaning that the marginal of a mixture is just the mixture of marginals. On the other hand, let P be an arbitrary product node in a decomposable and smooth PC, computing the factorized distribution ()=()′(), P( x)= N( y)\, N ( z), where we assume that the product node has only two input nodes ,′ N, N (the case for arbitrarily many inputs works the same). Due to decomposability, the scopes of the two nodes, =[] Y= X[ N] and =[′] Z= X[ N ], are disjoint. Assume we want to marginalize a single dimension XiX_i from P. Due to decomposability, XiX_i must appear either in Y or Z, but not both. Say it appears in Y, then the marginal of P is ∫()dxi P( x)\,dx_i =∫()′()dxi = N( y)\, N ( z)\,dx_i =(∫()dxi)′(), = ( N( y)\,dx_i )\, N ( z), that is, XiX_i gets just integrated out only from N since ′ N is constant with respect to XiX_i. If we further want to integrate out another random variable XjX_j which appears in Z we get ∫()dxidxj P( x)\,dx_i\,dx_j =∫()′()dxidxj = N( y)\, N ( z)\,dx_i\,dx_j =(∫()dxi)(∫′()dxj), = ( N( y)\,dx_i )\, ( N ( z)\,dx_j ), since N is now constant with respect to XjX_j. Consequently, when we want to integrate out arbitrarily many random variables, the single-dimensional integrals just distribute to the factor where the corresponding variables appear, or in other words, the marginal of a factorized distribution is just the factorization of the marginals. Thus, as long as the mixture components of sum nodes and the factors of product nodes “know” how they can do marginalization, the sum and product nodes just need to do their “usual job”. When we want to take a marginal of a PC, we apply the integrals to the root. Since the root is either a sum or product node, we can reduce its marginal to the marginals of its input nodes, which are either distributions nodes or again sum and/or product nodes. In the former case we are done, in the latter case we again reduce marginalization to the input nodes of the input nodes. In that way, we recursively delegate the marginalization downwards until the input distributions are reached. For these, however, we were assuming how to do marginalization in the first place. We can summarize this principle by the definition of a marginal PC. Definition 15 (Marginal PC). Let a decomposable and smooth PC =(V,E)G=(V,E) representing a joint distribution p_ X be given, and let , Y, Z be a partition of X, i.e., ∩=∅ Y∩ Z= , ∪= Y∪ Z= X. Define another PC ′=(V′,E′)G =(V ,E ) which is an exact copy of G, except that each ∈V D∈ V is replaced with a marginal distribution ′∈V′ D ∈ V , with ∩[] Z∩ X[ D] being marginalized out. In the case that ∩[]=[] Z∩ X[ D]= X[ D], i.e. that all random variables are marginalized from the input distribution, ′≡1 D ≡ 1. The PC ′=(V′,E′)G =(V ,E ) is called the Y-marginal PC of G. From the considerations above it follows that the Y-marginal PC computes the exact marginal p_ Y. Note that the marginal PC might now contain constants 11 as input nodes, so that strictly speaking it is not a PC according to Definition 12. However, we might either interpret these constant input nodes as “distribution over empty sets of random variables” or we can prune them in linear time from the marginal PC, making it a proper PC according to Definition 12. 5.3 Conditioning With marginalization at hand, we also know how to compute conditionals, which are just a ratio between the joint and a marginal: p(|)=p(,)p()=p(,)∫p(,)p( y\,|\, z)=p( y, z) p( z)=p( y, z) p( y, z)\,d y (5.12) This requires that we compute two circuit evaluations, one for the joint and one for the marginal. We can do better and construct a conditional PC representing the conditional distribution explicitly. The insight here is, like for marginalization, that sum and product nodes allow to delegate the conditioning operations to their input nodes. Similarly as for marginalization, we require that conditioning is tractable for the input distributions. This is easy for one-dimensional input distributions (X) D(X), as the only possible conditional is to condition on the single variable delivering (x)(x)=1 D(x) D(x)=1, which is basically a distribution over an “empty set of random variables,” conditional on X=xX=x. For multivariate Gaussians (5.11), conditionals are available closed form. Specifically, let a Gaussian over , Y, Z with parameters μ and C be given. The conditional over Y given = Z= z is again Gaussian with mean and covariance |=+−1(−)|=−−1, μ_ Y| z= μ_ Y+ C_ Y Z C_ Z Z^-1( z- μ_ Z)~~~~~~~ C_ Y| z= C_ Y Y- C_ Y Z C_ Z Z^-1 C_ Z Y, (5.13) where μ_ Y and μ_ Z are the subvectors of μ containing the means corresponding to Y and Z, respectively, C_ Y Y and C_ Z Z are the squared submatrices of C containing the (co-)variances corresponding to Y, and Z, respectively, and C_ Y Z and C_ Z Y are rectangular submatrices of C, containing the covariances between Y and Z. Let S be an arbitrary sum node in a decomposable and smooth PCs, computing the distribution ()=∑∈()θ(), S( x)= _ N ( S) _ S N N( x), where without loss of generality we assume that []= X[ S]= X. Furthermore, also without loss of generality, we assume that the PC uses normalized sum weights and that each node is consequently a normalized distribution, as discussed in Section 5.1.2 Assume we want to compute the conditional distribution p|p_ Y| Z where , Y, Z is some partition of X. We can use the fact that the conditional is proportional to the joint and write: (|) S( y\,|\, z) ∝∑∈()θ(,) _ N ( S) _ S N\, N( y, z) (5.14) =∑∈()θ()⏞≕θ~(|) = _ N ( S) _ S N\, N( z) θ_ S N\, N( y\,|\, z) (5.15) =∑∈()θ~(|). = _ N ( S) θ_ S N\, N( y\,|\, z). (5.16) In (5.16) we see that the conditional of S is proportional to a linear combination of the conditionals of its inputs nodes. The weights θ~=θ() θ_ S N= _ S N\, N( z) are nonnegative but do not sum to one, while the conditionals (|) N( y\,|\, z) are properly normalized distributions. Hence, the proportionality factor must between (5.16) and (|) S( y\,|\, z) must be ∑∈()θ~ _ N ( S) θ_ S N, i.e., (|)=∑∈()θ()∑′θ′′()(|), S( y\,|\, z)= _ N ( S) _ S N\, N( z) _ N _ S N \, N ( z)\, N( y\,|\, z), which means that the the conditional of a mixture is a mixture of the conditionals, with modified mixture weights θ¯′≔θ()∑′θ′′() θ_ S N _ S N\, N( z) _ N _ S N \, N ( z). On the other hand consider a product node ()=(1)′(2), P( x)= N( x_1)\, N ( x_2), where we again assume that the product has only two inputs with scopes 1 X_1 and 2 X_2. The more general case with more than two inputs is straightforward. Let again , Y, Z be some partition of X and assume we want to compute (|) P( y\,|\, z). Define 1=∩1 Y_1= Y∩ X_1, 1=∩1 Z_1= Z∩ X_1, 2=∩2 Y_2= Y∩ X_2, 2=∩2 Z_2= Z∩ X_2. The conditional is given as (|)=(,)(), P( y\,|\, z)= P( y, z) P( z), which, since the marginal of a product is the product of the marginals, is (|)=(1,1)′(2,2)(1)′(2)=(1|1)′(2|2), P( y\,|\, z)= N( y_1, z_1)\, N ( y_2, z_2) N( z_1)\, N ( z_2)= N( y_1\,|\, z_1)\, N ( y_2\,|\, z_2), i.e., the conditional of a product is the product of the conditionals. Hence, similar as for marginalization, we can start at the root of a PC and ask the question what is its conditional distribution. If it is a sum or product node, we have a simple recipe to express its conditional again as a sum and product node of the conditionals of its input distributions. This “delegation” of the conditioning operator happens recursively until we reach the input distributions, for which we assumed tractable conditionals in the first place. We can summarize these insights with the definition of the conditional PC. Definition 16 (Conditional PC). Let a decomposable and smooth PC =(V,E)G=(V,E) representing a joint distribution p_ X be given, and let , Y, Z be a partition of X, i.e., ∩=∅ Y∩ Z= , ∪= Y∪ Z= X. Let a state z be given. For each ∈V N∈ V, let () N( z) be the evaluation of the marginal PC, see Definition 15. Define another PC ′=(V′,E′)G =(V ,E ) which is an exact copy of G, except that each ∈V D∈ V is replaced with its corresponding conditional distribution ′ D over ∩[] Y∩ X[ D], conditioned on [] z[ D]. In the case that ∩[]=[] Z∩ X[ D]= X[ D], i.e. that all random variables are conditioned on, ′≡1 D ≡ 1. Furthermore, replace for each sum node S the weights as θ←θ()∑′θ′′() _ S N← _ S N\, N( z) _ N _ S N \, N ( z) The PC ′=(V′,E′)G =(V ,E ) is called the z-conditional PC of G. Due to the considerations above, the z-conditional PC represents the exact conditional p|p_ Y| z of the original PC. 5.4 Expectations and Covariances We see that decomposable and smooth PCs have excellent properties in terms of probabilistic inference, as the two core routines—marginalization and conditioning—can be be computed exactly and efficiently. Furthermore, decomposability and smoothness also allow to compute the expectation (vector) and covariance (matrix) of a PC. Expectation of PC. Following a similar argument as for marginalization, it can be shown that [] E[ X] can be computed exactly and efficiently when p_ X is represented as a PC. This follows from the fact that the expectation of a mixture is the mixture of expectations: []=∫(∑∈()θ())=∑∈()θ∫()=∑∈()θ[], E_ S[ X]= ( _ N ( S) _ S N\, N( x) )\, x\,d x= _ N ( S) _ S N\, N( x)\, x\,d x=\ _ N ( S) _ S N\, E_ N[ X], (5.17) and hence the expectation of a sum node is recursively given via the expectations of the sum’s input nodes. Furthermore, it is easily shown that the expectation of a factorized distribution is given as the concatenation of the expectations of the factors. Hence, also the expectation of a product node is recursively given via the expectations of the product’s input nodes. This translates into a simple algorithm formulated as a network pass over the PC: • For each input distribution D, compute [[]] E_ D[ X[ D]], i.e. the expectation of the distribution node over its scope. • For each sum node compute its expectation as in (5.17). • For each product node, compute the expectation as the concatenation of the expectations of its input nodes. In contrast to marginalization and conditioning, here the messages passed through the network are vector-valued. The output of this procedure, the vector computed at the root node, will be exactly the expectation of the PC. Covariances. Furthermore, the covariance of a PC can be computed efficiently, again via a recursive argument translating into a network pass. Considering first a sum node computing the mixture ()=∑k=1Kθkk(), S( x)= _k=1^K _k\, N_k( x), (5.18) where |()|=K|in( S)|=K and we have enumerated the inputs to S as 1,…,K N_1,…, N_K using an arbitrary but fixed order. A key technique in mixture models is to interpret them as latent variable models.55 5 This theme translates to PCs as well, as I have studied in peharz2016latent. In particular, (5.18) can be interpreted as the marginal distribution of an augmented model including a latent categorical variable Z taking values in 1,…,K\1,…,K\ p,Z(,k)=pZ(k)p|Z(|k),p_ X,Z( x,k)=p_Z(k)\,p_ X|Z( x\,|\,k), (5.19) where pZ(k)≔θkp_Z(k) _k and p|Z(|k)≔k()p_ X|Z( x\,|\,k) N_k( x). Indeed, marginalizing Z from (5.19) yields exactly the original mixture (5.18). The latent variable interpretation allows us to express the covariance []cov[ X] via the law of total covariance: []=Z[[|Z]]+Z[[|Z]].cov[ X]= E_Z [cov[ X\,|\,Z] ]+cov_Z [ E[ X\,|\,Z] ]. (5.20) Here [|Z=k]cov[ X\,|\,Z=k] is just the covariance of the kthk^th input node to the sum node, which we assume to be tractable. Hence the first term in (5.20) is simply the mixture of these covariances: Z[[|Z]]=∑kθk[|Z=k]. E_Z [cov[ X\,|\,Z] ]= _k _k\,cov[ X\,|\,Z=k]. (5.21) Furthermore, [|Z=k] E[ X\,|\,Z=k] is just the expectation of the kthk^th input node, which is computed as described in the previous paragraph. By denoting k≔[|Z=k] μ_k E[ X\,|\,Z=k] and the expectation of the sum node ≔∑kθkk μ _k _k μ_k, we get that the second term in (5.20) is given as Z[[|Z]]=∑kθk(k−)T(k−).cov_Z [ E[ X\,|\,Z] ]= _k _k( μ_k- μ)^T( μ_k- μ). (5.22) Hence, the covariance matrix of a sum node is recursively given via the covariances of its inputs, as in (5.18). Furthermore, the covariance matrix of a factorized distribution is simply a block-diagonal matrix, whose on-diagonal blocks are given by the covariances of the factors and the remaining entries are zero (due to independence). Here, without loss of generality, we assume that the random variables in the scopes of input nodes are “neighboring” in the covariance matrix—if they were not, the rows and columns would be permuted in some way. In total, this again leads to an algorithm formulated as a network pass over the PC, where the messages passed through the network are matrix-valued. • For distribution nodes compute covariance matrices directly from input distributions (e.g., covariance parameters of Gaussian nodes). • For sum nodes compute the covariance as in (5.20). • For product nodes construct a block-diagonal covariance matrix from input covariances: []=([1]…[2]…⋱…[n]).cov[ X]= pmatrixcov[ X_1]&0&…&0\\[6.0pt] 0&cov[ X_2]&…&0\\[6.0pt] & & & \\[6.0pt] 0&0&…&cov[ X_n] pmatrix. 5.5 Determinism and Most Probable Explanation So far, we were assuming only decomposability and smoothness, which already brought us far. Another powerful structural property is determinism, which, in combination with decomposability, enables efficient computation of a most probable explanation (MPE), i.e. most likely joint assignment of variables: MPE=argmaxxp().MPE= _xp( x). (5.23) Determinism in PCs is defined as follows. Definition 17 (Determinism). A sum node S in a PC is called deterministic if at most one input node is non-zero for any given complete assignment x: ∀:|∈():()>0|≤1.∀ x |\ N ( S): N( x)>0\|≤ 1. (5.24) A PC is deterministic of all its sum nodes are deterministic. Determinism and decomposability allow to compute an MPE with a single forward pass through the PC. Like for the other inference routines above, this procedure follows by recursion. First, consider a deterministic sum node S, for which we want to compute argmax()=argmax∑∈()θ(). _ x~ S( x)= _ x~ _ N ( S) _ S N\, N( x). (5.25) Due to determinism at most one input node is non-zero, for any x, hence we can replace the summation in (5.25) by a maximum argmax()=argmaxmax∈()θ(), _ x~ S( x)= _ x~ _ N ( S) _ S N\, N( x), (5.26) which commutes with the maximum over x: argmax() _ x~ S( x) =argmax∈()maxθ() = _ N ( S) _ x~ _ S N\, N( x) (5.27) =argmax∈()θmax(). = _ N ( S) _ S N\, _ x~ N( x). (5.28) Thus, if we know how to compute an MPE for each input node N, the MPE of S is given by selecting the MPE of the input node that maximizes θ() _ S N\, N( x). Similarly, consider a decomposable product node ()=∏∈()(). P( x)= _ N ( P) N( x). It is easy to see that the product is maximized by maximizing individually each input node. Hence the MPE of a decomposable product is simply the concatenation of the MPEs of its input nodes. Consequently, MPE inference can be implemented as a simple forward pass through the PC, where messages are MPE solutions (vectors) together with the maxima they achieve: • For each distribution node, compute the MPE assignment (which is assumed to be tractable). • For each sum node, select the MPE of the input node that maximizes the weighted density evaluated at its MPE. • For each product node, combine the MPE assignments from its inputs. Determinism has other attractive properties as well. In particular, it allows to compute a fast computation of (global) maximum likelihood parameters peharz2014learning and a closed-form solution for Bayesian structure scores yang2023bayesian. 5.6 Further Structural Properties and Tractable Inferences We see that PCs achieve tractability by exploiting structural properties such as decomposability, smoothness, and determinism. Further structural constraints enable additional efficient inference routines and operations, extending the applicability of PCs to complex probabilistic queries vergari2021compositional. A strengthened notion of decomposability is structured decomposability, which requires that two product nodes with identical scopes partition their scope identically. Structured decomposability allows to construct tractable circuits representing operations such as products and quotients of circuits, powers of circuits, and logarithms of circuits, which are essential for “advanced” inference queries, in particular combinations of probability and logic. Two structured-decomposable circuits with identical structure—but different parameters—are called compatible, meaning they can be efficiently combined into a new structured-decomposable circuit without introducing exponential complexity. Some circuits are omni-compatibile, which are compatible with any other smooth and decomposable circuit over the same scope X. Omni-compatibility often arises naturally, such as in fully-factorized models or mixtures thereof. (Omni-)compatible PCs support various tractable inference routines beyond marginalization and conditioning, in particular exact computation of complex information-theoretic measures such as Kullback–Leibler divergence, cross-entropy, and mutual information. See vergari2021compositional for a systematic overview of these structural properties and the inferences they entail. 5.7 Overview of Contributions In the first part of this habilitation thesis, I highlight the role of probability as an excellent core language for AI: representations of joint distributions (probabilistic models) shall be interpreted as knowledge base, capturing both dependencies between random variables and their uncertainties. This knowledge base is used for probabilistic reasoning, by combining various core inference routines, such as marginalization, conditioning, expectations and most probable explanation. While probability constitutes a simple, elegant and optimal calculus of reasoning, the downside is that probabilistic inference is a computational nightmare. Probabilistic circuits (PCs)—the central topic of this theses—are in a nutshell an elegant approach to probabilistic modeling as they ensure that inference remains tractable, that is, computable exactly in polynomial time. The key to tractability lies in structural constraints, such as smoothness, decomposability, determinism, and structural decomposability, where different combinations of constraints lead to different tractable inference routines. In conclusion of the first part, I provide a brief overview of 17 key papers I have published in the area of PCs in the last ten years, which are then provided in Part I. 5.7.1 Foundations and Theory of PCs Part of my early work around PCs was focused on foundational aspects. I was first exposed to these ideas via sum-product networks (SPNs) poon2011sum,66 6 Sum-product networks are the special case of smooth and decomposable PC. which were proposed as a generalization of arithmetic circuits (ACs) darwiche2003differential.77 7 Arithmetic circuits are basically equivalent to smooth, decomposable and deterministic PCs. The main proposed innovation in SPNs was that they were learned directly form data, that they did use unnormalized sum weights and that they generalized the notion of decomposability to the notion of consistency. Thus, a natural question was how much these generalizations extend the modelling capabilities. In peharz2015theoretical; peharz2015foundations I have shown that they are actually quite vacuous: in particular, it turned out that any smooth and decomposable PC with unnormalized sum weights can be transformed into PC with the same structure and normalized sum weights, still representing the same distribution. This shows that using unnormalized weights does not improve the model power. The transformation of sum weights can be done with a single sweep over the PC and hence is also quite efficient. Further, I show in this paper that consistency is not significantly improving the model power either. In particular, any smooth and consistent PC can be transformed into a smooth and decomposable PC by increasing the size of the PC at most by a factor linear in the number of random variables.88 8 In order to show that one model class is significantly more expressive than another, one needs to show “exponential separation”, i.e. that there exists a family of distributions with polynomial representation size in the first model class and exponential size in the second. In peharz2016latent, I addressed the interpretation of PCs as hierarchical latent variable models, similar as finite mixture models (e.g. Gaussian mixture models) can be interpreted as latent variable models with a single latent categorical variable. This interpretation is important as it establishes a structured view on PCs, enabling the derivation of an exact ancestral sampling algorithm, the classical expectation-maximization algorithm, a sound interpretation of an approximate MPE algorithm proposed in poon2011sum, and the interpretation of PCs as a Bayesian network (BN) koller2009probabilistic involving latent variables. The latter can be interpreted as a “decompilation algorithm”, converting a PC into a BN, which we further studied in butz2020sum. The latent variable interpretation in PCs can further be exploited as a representation of data, as we have studied in vergari2018sum. Parts of the contributions in peharz2016latent also appeared in peharz2015foundations. A further paper worth mentioning is with Trapp et al. trapp2017safe, where we proposed a safe semi-supervised learning algorithm for PCs, i.e. using PCs as classifiers trained on both labelled and unlabelled data, with the guarantee that the performance on labelled data can only increase when adding unlabelled data. 5.7.2 Bayesian Approaches with PCs Any parametric machine learning model can be rendered into a Bayesian version: rather than optimizing some loss function with respect to the model parameters one rather (i) equips the parameters with a prior distribution and (i) infers a parameter posterior given data via Bayes rule. Advantages of Bayesian approaches are that they are generally less prone to overfitting and represent model uncertainty explicitly. In vergari2019automatic we proposed a Bayesian inference algorithm for PC parameters based on Gibbs sampling. Moreover, the leaves of PCs were generalized to mixtures over various exponential distributions representing different data types, where inference over the data types was also included in the Gibbs sampler. This, together with the latent variable interpretation, allowed to perform automatic recognition of the data type in an “anonymous data table” and further yielded highly-interpretable model, both by its structure and the tractable inference queries PCs facilitate. In trapp2019bayesian we used a similar Bayesian inference algorithm by Gibbs sampling, but extended the learning to PC structure, allowing us to learn both parameters and structure in a single Bayesian setting. A major drawback of Bayesian approaches in PCs is that they are, to a certain extent, in conflict with tractability: while smooth and decomposable PCs allow tractable marginalization and conditioning, the Bayesian version of them does not. However, including the additional property of determinism and the use of factorized Dirichlet priors on the sum weights allows to perform Bayesian averages in closed form. In yang2023bayesian this property was used to derive Bayesian structure scores heckerman1995learning for deterministic PCs. These scores are a principled score to compare different model structures in light of observed data and allow to learn an optimal structure in the infinite data limit. While these scores were well-established in the graphical models literature koller2009probabilistic; heckerman1995learning, our paper was—and to the time of writing this thesis still is—the only principled structure score proposed for PCs. 5.7.3 Deep Learning and PCs Deep learning has without doubt been the most impactful technology in AI up to now. While the field of deep learning us truly massive, its basic principle is rather simple: (i) express the learning task as a function approximation problem, (i) construct an expressive function approximator via a (large) computational graph, i.e. a composite function whose structure is described by directed acyclic graph over (differentiable) predefined functions, (i) use automatic differentiation to compute gradients of model parameters, which is used in (iv) gradient-based optimization of a suitable loss function governed by the training data. Many tricks of the trade contributed to the success of deep learning we are witnessing today, but a particular game changer was the development of dedicated libraries such as Tensorflow tensorflow2015-whitepaper and PyTorch NEURIPS2019_9015, which allow to implement and train deep models with ease. PCs are also computational graphs and can be understood as special case of neural networks, whose input layer contain non-linear functions (densities) and whose higher layers either contain product or linear units. Additionally, as discussed before, we apply some suitable subset of structural constraints in order to unlock tractable inference queries of our choice. It is hence natural to use PCs as deep learning models as well. In particular, they might be implemented in deep learning frameworks, benefit from GPU-acceleration and automatic differentiation, and might be easily interfaced with other deep learning models. However, my first attempts to implement PCs on Tensorflow were naive, as I implemented each individual node as a separate node. This led to huge and sparsely connected computational graph of small operations, which is a very GPU-unfriendly design. The first decent implementation of PCs on Tensorflow were RAT-SPNs peharz2020random, which vectorized input distributions and sum nodes, and product nodes were replaced with “unrolled” outer products. The resulting computational graph had much fewer nodes and a higher degree of parallelism. This implementation allowed to scale PCs to relatively large dataset such as (fashion)MNIST, but it was still about 5050 times slower than a comparable multi-layer perceptron (MLP). The main reason for this bottleneck was the “scattered” and sparse graph induced by the PCs’ structural constraints. Taking lesson from these insights I developed einsum networks (EiNets) a further accelerated implementation for PCs peharz2020einsum. The main idea in this paper was to further increase the degree of parallelism by “summarizing” several vectorized sum nodes into a bigger layer (tensor) and implementing all sum-product operations from one layer to the next with one monolithic call to the einsum-function.99 9 Einsum is implementing the Einstein sum-product contraction. It allows to represent all linear algebra operations as a parametrized call to einsum. It is readily implemented and optimized in deep learning frameworks. EiNets were now approximately en par with MLPs of comparable size,1010 10 My implementation, just using standard einsum, was just about 55 times slower than MLPs. With further optimization, e.g. implementing dedicated GPU-kernels, this difference can be made even. and scaled to datasets sizes which were previously out of reach for PCs. This central principle in this paper indicates a strong connection between PCs and tensor factorization, which has further been addressed in loconte2024relationship. Another interesting contributions in this paper was a simple implementation of EM which relied entirely on standard backpropagation. As mentioned above, implementing PCs on deep learning frameworks makes them operationally compatible to neural networks. In particular, one can now construct conditional PCs shao2020conditional; shao2022conditional, representing conditional distributions p(|)p( y\,|\, x), by devising a PC structure over Y, whose parameters () θ( x) depend functionally on some context x. One is completely free how to represent () θ( x) and might use arbitrary neural networks for this purpose. As long as the PC satisfies the structural constraints with respect to Y, it allows, for any x, tractable inference in the distribution p(|)p( y\,|\, x). Several of such conditional PC can also be combined into block-wise autoregressive models, for example as expressive generative models over images. Furthermore, PCs lead to other interesting applications in deep learning. In particular, if one allows for unconstrained (negative and positive) sum-weights and replaces the input densities with arbitrary non-linear functions, one yields a (non-probabilistic) circuit or decomposable neural network subramaniexact. This architecture is less constrained than PCs and has interesting applications. In particular, in subramaniexact, we exploited the fact that expectations over diagonal (independent) Gaussians inputs can be tractably computed in deconets which can be used in exact robustness guarantees concerning adversarial attacks cohen2019certified. 5.7.4 Hybrid Models and Inference PCs make a fantastic promise, as probabilistic inference, which is generally NP-hard in most representations of joint distributions, is easy when the distribution is represented as a PC. The catch is that this property weakens the expressive power of PCs. One seems to be confronted with a dichotomy: Do we want tractable inference and hence go with PCs (or some other tractable model)? Or do we need expressive power and hence go with highly expressive models such as VAEs, GANs, Flows, auto-regressive models, etc., and accept the fact that inference needs to be approximated? It is suggestive that this is a false dichotomy and that there actually exists an interesting (and largely unexplored) middle ground of hybrid models: tractable where possible, approximate where required. Some of my work has explored some options to achieve such hybrid models. In stelzner2019faster we have proposed a variation of the attend-infer-repeat (AIR) system eslami2016attend using PCs as a sub-module of an intractable model. Specifically, the AIR system is a method for Bayesian visual scene analysis, putting a prior on the scene, in particular on the number of objects, their category, scale, position, etc. Further, it uses a rendering procedure to specify a likelihood of an observed image given a latent scene. The goal is to infer the latent scene given an observed image, naturally formulated as Bayesian posterior inference. The AIR system solves this task by using a recurrent neural network to infer objects sequentially and removing them from the scene. In the generative model, the different object categories are represented with object-specific VAEs kingma2019introduction. Hence, the entire model contains several thousand latent random variables to be inferred, in particular random variables describing the scene descriptions, pixels and VAE-codes of objects. The inference method of AIR was entirely based on amortized variational inference. In stelzner2019faster we replaced the object models with PCs and devised a technique to marginalize them from the posterior, leaving just a few variables for the scene description to be inferred. Hence, the entire system was not ‘fully tractable’, but we solved large parts of the inference problem via tractable inference and inferred the rest with variational inference. Here, the intuition is that intractable models over few variables are ‘more tractable’ than intractable models over many variables.1111 11 Note that this is a rule-of-thumb line of reasoning and making this theoretically concrete requires much deeper thought. The main result in our paper was faster convergence of scene inference—even though we use the slow implementation of peharz2020random—as well as more stable results of the variational inference routine. Rather than taking PCs as sub-modules of intractable models one might also use intractable modes as sub-modules of PCs. Specifically, in tan2019hierarchical we used VAEs kingma2019introduction as PC leaves. This is syntactically valid, as VAEs are merely infinite mixture distributions. We further showed that stochastic ELBO estimates, which are used as learning signal in vanilla VAEs, can be used as replacement of log-likelihoods for the PC leaves, yielding an ELBO estimate for the hybrid PC/VAE model and hence a sound learning objective. The main insight is, again, that the VAE leaves can be much smaller than a regular VAE (in particular their latent code can be of smaller dimensionality), since they model only part of the random variables. Hence, the resulting model is a ‘collection of many small intractable models, glued together via a tractable model’, which intuitively might yield a simpler inference problem.1212 12 Again, this is an qualitative argument. In our experiments we indeed showed that our hybrid model learned faster and achieved higher log-likelihoods than vanilla VAEs. Basically the same idea was pursued in trapp2020deep but using Gaussian processes (GPs) williams2006gaussian as leaves rather than VAEs. GPs actually do admit tractable inference, but require cubic time and quadratic memory in the number of samples, which becomes a notorious bottleneck for a large number of samples. Besides using sparse inducing point techniques quinonero2005unifying, the most popular technique to address this problem is to use a divide-and-conquer approach, by splitting the data points in subsets, performing GP inference on these subsets and aggregating the results. In trapp2020deep, we also followed this principle by devising a PC structure over local GP experts. Unlike other divide-and-conquer approaches, our model was a sound and well-defined probabilistic model and still admitted exact inference, resulting in more faithful inferences than the baselines. In correia2023continuous and gala2024probabilistic we explored a further interesting principle to combine tractable models with intractable ones. The basic idea in these papers was to augment the PC formalism with a new type of node: an integral node. Formally, an integral node is equipped with a continuous latent random variable (or random vector) distributed according to some simple distribution, like Gaussian. PC parameters below this integral node then depend functionally on this latent variable, yielding an infinite mixture of PCs. Note that VAEs can also be described in this framework and just contain a single integral node. Unlike VAEs, in correia2023continuous; gala2024probabilistic we leveraged numerical integration techniques (quadratures), for which approximation guarantees can be derived. To this end, the dimensionality of the latent continuous variables need to be kept small enough, as numerical integration scales badly to large dimension. The main outcome of these papers was that PCs with integral nodes outperform classical PCs. 5.7.5 PCs and Symbolic Models PCs have a close connection to (tractable) logical circuits darwiche2002knowledge; darwiche2003differential, which enables neuro-symbolic approaches by combining the two ahmed2022semantic. Moreover, they have natural connections to other machine learning models and symbolic methods. In correia2020joints, we established a connection between probabilistic circuits and decision trees. In particular, decision trees can be transformed into PCs by transforming each decision node into a sum node over products of the sub-trees below the decision node and indicator nodes representing the respective decisions. Additionally, • one attaches weights to the generated sum nodes given by the normalized counts of samples split by the decision, conditional on all decisions above the decision node; • one also augments the classifier associated with each of the leaves—a conditional distribution over the prediction target—by multiplying it with a (simple) joint distribution over features using the samples associated to the leaf. The resulting PC represents a joint distribution p(,y)p( x,y), over both features x and target y rather than a conditional model p(y|)p(y\,|\, x). The conditional distribution derived from this joint, however, is under certain conditions exactly the same is the original decision tree classifier. Hence, learning a decision tree and transforming it into a PC can be seen as augmenting it into a full joint distribution, still yielding the same classifier in a “backward compatible way”. Advantages of this procedure are, among others, the possibility to treat missing input features by PC marginalization and to detect outliers by monitoring the probability of input features p()p( x). Furthermore, also random forests can by augmented to generative models by re-interpreting them as mixtures of PCs obtained from the individual decision trees. In loconte2023turn we established a connection between knowledge graph embeddings (KGEs) and PCs. Knowledge graphs are a prominent symbolic representation of domain knowledge. Formally, they are directed multi-graphs whose nodes are entities and whose edges correspond to predicates between entities. The entity where an edge starts is called subject and the entity where it ends is called object. The entire knowledge graph can be understood as a collection of subject-predicate-object (SPO) triplets. Typical tasks in knowledge graphs are link prediction (which is important because most knowledge graphs are severely incomplete) and inferring new predicates, e.g. by learning and applying rules among predicates Knowledge graphs are typically used in machine learning applications by leveraging KGEs, obtained by constructing vector-valued representations for entities and predicates, which can be combined into an SPO embedding by applying some function to the S-, P- and O-embeddings. A wide range of functions have been proposed in literature, where many of them are using some sum-product form, making them reminiscent to PCs. In loconte2023turn, we made this connection explicit and devised ways to modify common KGEs into bona-fide PCs. The advantages of this approach are, among others, that standard maximum likelihood training can used to learn KGEs (instead of perhaps less principled techniques such as pseudo-likelihood and contrastive techniques), that our approach allows to sample from the distribution over SPO triplets, faster inference for triplets with missing entities or predicates and the possibility to encode hard logical constraints in KGEs. Finally, in wedenig2024exact we used logical circuits and probabilistic inference to construct the first exact approach for soft analytic side-channel attacks (SASCA) veyrat2014soft. SASCA highlights vulnerability of cryptography algorithms (such AES) to physical information leaks, where any kind of physical side-channel might be used, such as power traces, heat dissipation, and hardware timing. SASCA assumes that an attacker has access to a physical copy of a device running a cryptographic algorithm. By querying the device with many random inputs of plain message and key, the attacker can learn so-called templates, i.e. probabilistic models mapping from side-channel to intermediate computations in the algorithm. These “soft guesses” can be integrated by exploiting the logical structure of the cryptographic algorithm, which can be formulated as probabilistic inference in a factor graph loeliger2004introduction, inferring the secret key from the observed side channel. The standard approach in SASCA is to use loopy belief propagation for inference, which has few theoretical guarantees and whose inference quality is hard to assess. In wedenig2024exact, we used a knowledge compilation approach darwiche2002knowledge to compile large parts of the factor graph into a circuit representation and leveraged PC inference for exact inference about the key. The result was a dramatic increase of success rate and a higher tolerance against noise, which highlights further vulnerabilities against protected implementations of cryptographic algorithms.