图模型刻画随机变量之间的依赖关系,从而决定其联合概率分布如何分解。本章回顾图模型的关键概念及其与求导之间的联系,并在叙述过程中与计算链、计算图进行类比。A graphical model specifies how random variables depend on each other and therefore determines how their joint probability distribution factorizes. In this chapter, we review key concepts in graphical models and how they relate to differentiation, drawing in the process analogies with computation chains and computation graphs.
概率的链式法则是概率论中计算事件联合概率的基本法则。当只有两个事件 与 时,它退化为乘积法则The chain rule of probability is a fundamental law in probability theory for computing the joint probability of events. In the case of only two events and , it reduces to the product rule
对于两个离散随机变量 与 ,取事件 与 ,乘积法则即化为For two discrete random variables and , using the events and , the product rule becomes
更一般地,借助乘积法则,对 个事件可得More generally, using the product rule, we have for events
再次运用乘积法则,便得到Applying the product rule one more time, we have
如此递归重复,最终得到概率的链式法则Repeating the process recursively, we arrive at the chain rule of probability
对 个离散随机变量 ,取事件 ,概率的链式法则即为For discrete random variables , using the events , the chain rule of probability becomes
重要的是,这一分解并不需要对变量 作任何独立性假设。换言之,右侧条件概率乘积所刻画的概率分布空间,与左侧联合概率所刻画的概率分布空间是同一个空间。若再引入额外的条件独立性假设,还可进一步简化这一分解。Importantly, this factorization holds without any independence assumption on the variables . In other words, the space of probability distributions specified by the joint probability on the left-hand side, and the space of probability distributions specified by the product of conditional probabilities on the right-hand side, are the same. We can further simplify the factorization if we make additional conditional independence assumptions.
我们知道,若两个事件 与 相互独立,则We know that if two events and are independent, then
类似地,若两个随机变量 与 相互独立,则Similarly, if two random variables and are independent, then
更一般地,考虑 个变量 ,其中一些变量可能彼此依赖,另一些则可能不依赖。为简化记号,给定集合 ,我们定义如下简写More generally, if we work with variables , some variables may depend on each other, while others may not. To simplify the notation, given a set , we define the shorthands
称变量 在给定 的条件下独立于 ,其中 ,若对任意 都有We say that a variable is independent of conditioned on , with , if for any
考虑一组 个变量 ,它们可以是有序的,也可以是无序的。每个 都属于笛卡尔积 。为具体起见,本章始终假设各集合 是离散的,且 。注意,由于 是离散的,我们总可以将其与 等同起来。图模型指定了一个联合概率分布We consider a collection of variables , potentially ordered or unordered. Each belongs to the Cartesian product . Throughout this chapter, we assume that the sets are discrete for concreteness, with . Note that because is discrete, we can always identify it with . A graphical model specifies a joint probability distribution
其中 是该联合概率分布的概率质量函数。对所有可能配置构成的笛卡尔积求和,可得where is the probability mass function of the joint probability distribution. Summing over the Cartesian product of all possible configurations, we obtain
正如我们将要看到的,图模型的图结构编码了变量 之间的依赖关系,从而也编码了它们的联合分布如何分解。给定一个联合概率分布,通常需要解决若干推断问题。As we shall see, the graph of a graphical model encodes the dependencies between the variables and therefore how their joint distribution factorizes. Given access to a joint probability distribution, there are several inference problems one typically needs to solve.
一个简单的任务是计算某些观测 的似然,A simple task is to compute the likelihood of some observations ,
计算对数似然也很常见,It is also common to compute the log-likelihood,
另一个常见任务是计算最可能的配置,Another common task is to compute the most likely configuration,
这是联合概率分布的众数。在文献中,这也被称为最大后验(MAP)推断 [206]。This is the mode of the joint probability distribution. This is also known as maximum a-posteriori (MAP) inference in the literature [206].
边缘化操作是指对联合概率分布中某个给定变量的所有可能取值求和(或积分),由此可以计算其余变量的边缘概率。例如,我们可能希望除 之外,对所有其他变量进行边缘化。为此,我们定义笛卡尔积The operation of marginalization consists in summing (or integrating) over all possible values of a given variable in a joint probability distribution. This allows us to compute the marginal probability of the remaining variables. For instance, we may want to marginalize all variables but . To do so, we define the Cartesian product
| (10.1) |
对所有变量求和( 除外),得到 的边缘概率,即Summing over all variables but , we obtain the marginal probability of as
类似地定义Defining similarly
可得we obtain
特别地,我们可能希望计算两个相邻变量的边缘概率,。In particular, we may want to compute the marginal probability of two consecutive variables, .
另一种常见操作是计算 在分布 下的期望,其定义为Another common operation is to compute the expectation of under a distribution . It is defined by
对于 下的期望,我们记作For the expectation under , we write
在指数族分布(3.4 节)中,函数 称为统计量,它可以分解为In exponential family distributions (Section 3.4), the function is called a statistic. It decomposes as
其中 。直观地说, 可以看作 (一个可能离散的对象,例如一个整数序列)在向量空间中的编码或嵌入。在这种分解下,我们还可以计算where . Intuitively, can be thought of as an encoding or embedding of (a potentially discrete object such as a sequence of integers) in a vector space. Under this decomposition, we can also compute
均值 属于 的凸包,The mean belongs to the convex hull of ,
其中 是 上所有可能概率分布的集合。换言之, 是 在 下所有可能凸组合的集合。 的顶点正是所有的 。where is the set of all possible probability distributions over . In other words, is the set of all possible convex combinations of for . The vertices of are all the .
在离散集合 与二值编码(指示函数) 的特殊情形下,集合 称为边缘多胞形 [206],因为其中每个点 都包含边缘概率。为说明其中的原因,考虑一元势函数In the special case of a discrete set and of a binary encoding (indicator function) , the set is called the marginal polytope [206], because each point contains marginal probabilities. To see why, consider the unary potential
| (10.2) |
其中当 为真时 ,否则为 。于是我们得到 的边缘概率,where if is true, otherwise. We then obtain the marginal probability of ,
同样地,考虑成对势函数Likewise, consider the pairwise potential
| (10.3) |
于是我们得到 与 的边缘概率,We then obtain the marginal probability of and ,
对于高阶势函数,也可以做同样的处理。We can do the same with higher-order potential functions.
除了计算似然(这是平凡的)之外,用暴力方法计算边缘概率、众数和期望需要 时间。特别地,若 ,暴力计算需要 时间。Apart from computing the likelihood, which is trivial, computing the marginal, mode and expectation by brute force takes time. In particular, if , brute force takes time.
本节简要回顾马尔可夫链。我们之所以选择这样的记号,是为了强调它与计算链的类比。In this section, we briefly review Markov chains. Our notation is chosen to emphasize the analogies with computation chains.
当随机变量按顺序组织为 时,条件独立的一个简单例子是:每个变量 只依赖于前一个变量 ,即When random variables are organized sequentially as , a simple example of conditional independence is when each variable only depends on the previous variable , that is,
满足上述条件的概率分布称为满足马尔可夫性质,并称为马尔可夫链。计算链由函数 指定,这些函数以 为输入,输出 。与之类似,马尔可夫链由给定 时 的条件概率分布 指定。于是便可定义如下生成过程A probability distribution satisfying the above is said to satisfy the Markov property, and is called a Markov chain. A computation chain is specified by the functions , that take as input and output . In analogy, a Markov chain is specified by the conditional probability distributions of given . We can then define the generative process
严格说来,我们应当写作 。之所以采用这一记号,既是为了简洁,也是为了与计算链相类比。此外,为简化记号,我们不失一般性地假设 是确定性的(若非如此,我们总可以把 移入 ,并添加一个哑变量作为 )。也就是说,,且 。这相当于将 的初始分布设为Strictly speaking, we should write . We choose our notation both for conciseness and for analogy with computation chains. Furthermore, to simplify the notation, we assume without loss of generality that is deterministic (if this is not the case, we can always move to and add a dummy variable as ). That is, and . This amounts to setting the initial distribution of as
于是,马尔可夫链的联合概率可按如下方式计算We can then compute the joint probability of the Markov chain by
其中对 的依赖被隐含,因为 。具有 的马尔可夫链如图 10.1 所示。链定义了一个全序集 ,因为图中的任意两个节点都必定由某条路径相连。where we left the dependence on implicit, since . A Markov chain with is illustrated in Fig. 10.1. A chain defines a totally ordered set , since two nodes in the graph are necessarily linked to each other by a path.
时间齐次离散时间马尔可夫链对应于如下情形:无论 取何值,给定 时 的分布都相同:A time-homogeneous discrete-time Markov chain corresponds to the case when the distribution of given is the same regardless of :
有限空间情形是指每个 只能取有限集合 中的值,并且The finite-space case corresponds to when each can take a finite set of values and
其中 是从 到 的转移概率。由于集合 是离散的,我们总可以把它与 等同起来。也就是说,我们可以改写成where is the transition probability from to . Because the set is discrete, we can always identify it with . That is, we can instead write
更一般地, 阶马尔可夫链可能不仅依赖于最后一个变量,还依赖于最后 个变量,More generally, a -order Markov chain may depend, not only on the last variable, but on the last variables,
诸如 Transformer(4.8 节)等自回归模型,可以看作是在指定一个高阶马尔可夫链,其上下文窗口大小为 。上下文越大,用动态规划进行精确推断在计算上就越不可行。正因如此,实践者才改用束搜索或祖先采样(10.5.3 节)。Autoregressive models such as Transformers (Section 4.8) can be seen as specifying a higher-order Markov chain, with a context window of size . The larger context makes exact inference using dynamic programming computationally intractable. This is why practitioners use beam search or ancestral sampling (Section 10.5.3) instead.
本节我们简要回顾贝叶斯网络。我们选择这样的记号,是为了突出贝叶斯网络与计算图之间的类比。In this section, we briefly review Bayesian networks. Our notation is chosen to emphasize the analogies with computation graphs.
马尔可夫链以及更一般的高阶马尔可夫链,都是贝叶斯网络的特例。与 8.3 节所回顾的计算图类似,变量之间的依赖关系可以用有向无环图(DAG) 来表示:顶点 表示变量,边 表示变量间的依赖关系。集合 (其中 )指明了 所依赖的变量 。由此定义出一个偏序集(poset)。为记号简便起见,我们再次不失一般性地假设 是确定性的。计算图由按拓扑序排列的函数 指定。与之类似,贝叶斯网络则由给定 时 的条件概率分布 指定。于是我们可以定义如下的生成过程Markov chains and more generally higher-order Markov chains are a special case of Bayesian network. Similarly to computation graphs reviewed in Section 8.3, variable dependencies can be expressed using a directed acyclic graph (DAG) , where the vertices represent variables and edges represent variable dependencies. The set , where , indicates the variables that depends on. This defines a partially ordered set (poset). For notational simplicity, we again assume without loss of generality that is deterministic. A computation graph is specified by functions in topological order. In analogy, a Bayesian network is specified by conditional probability distributions of given . We can then define the generative process
借助概率的链式法则以及由 DAG 所表达的变量独立性,联合概率分布即为(假设 采用拓扑序)Using the chain rule of probability and variable independencies expressed by the DAG, the joint probability distribution is then (assuming a topological order for )
这种表示方式非常适合刻画随机变量之间的因果关系。This representation is well suited to express causal relationships between random variables.
在贝叶斯框架中,观测数据、隐变量、参数和噪声变量统统被视为随机变量。若与节点 相关联的条件分布 依赖于某些参数,则可以把这些参数经由父节点作为条件提供给 。In a Bayesian framework, observed data, latent variables, parameters and noise variables are all treated as random variables. If the conditional distribution associated to node depends on some parameters, they can be provided to as conditioning, using parent nodes.
贝叶斯网络由条件分布 指定。因此,与计算图不同,贝叶斯网络中并没有函数 这一概念。不过,贝叶斯网络的根节点可以是神经网络的输出。例如,RNN 或 Transformer 等自回归模型指定了在给定先前 token 的条件下下一个 token 的条件概率分布,再借助概率的链式法则得到整个序列上的概率分布。A Bayesian network is specified by the conditional distributions . Therefore, unlike computation graphs, there is no notion of function in a Bayesian network. However, the root nodes of the Bayesian network can be the output of a neural network. For instance, autoregressive models, such as RNNs or Transformers, specify the conditional probability distribution of a token given past tokens, and the chain rule of probability is used to obtain a probability distribution over entire sequences.
贝叶斯网络的一大优势在于:只要每个条件分布 都已归一化, 的联合分布便自动归一化。这意味着,我们只需遵循生成过程,就能轻而易举地从联合分布中抽取独立同分布的样本:按拓扑序 依次进行,在第 次迭代中,以先前的取值 为条件抽取取值 。这一过程称为祖先采样。A major advantage of Bayesian networks is that, provided that each conditional distribution is normalized, the joint distribution of is automatically normalized. This means that we can very easily draw i.i.d. samples from the joint distribution, by following the generative process: we follow the topological order and on iteration we draw a value conditioned on the previous values . This is known as ancestral sampling.
马尔可夫随机场(MRF),又称无向图模型,所指定的分布可分解为A Markov random field (MRF), a.k.a. undirected graphical model, specifies a distribution that factorizes as
其中 是 的极大团集合,即 中完全连通的子集; 是归一化常数,定义为where is the set of maximal cliques of , that is, subsets of that are fully connected, is a normalization constant defined by
而 是势函数(又称相容函数),满足 。根据 Hammersley-Clifford 定理,马尔可夫随机场亦可等价地用马尔可夫性质来定义;感兴趣的读者可参阅 [206]。就本章而言,上述定义已足以满足需要。and is a potential function (a.k.a. compatibility function), with . According to the Hammersley-Clifford theorem, an MRF can be equivalently defined in terms of Markov properties; we refer the interested reader to [206]. For the sake of this chapter, the definition above is sufficient for our purposes.
下面定义势函数Let us define the potential functions
其中 为某个充分统计量函数, 为参数。于是,for some sufficient statistic function and parameters . Then,
其中where
因此,对于这种势函数选择,我们可以把马尔可夫随机场视为一个指数族分布(3.4 节):其自然参数为 ,充分统计量为 ,对数配分函数为 。Therefore, for this choice of potential functions, we can view an MRF as an exponential family distribution (Section 3.4) with natural parameters , sufficient statistic and log-partition function .
条件随机场 [114, 192] 是马尔可夫随机场的一种特例,其中显式地引入了条件变量。例如,当目标是预测以变量 为条件的变量 时,条件随机场定义为Conditional random fields [114, 192] are a special case of Markov random field, in which a conditioning variable is explicitly incorporated. For example, when the goal is to predict a variable conditioned on a variable , CRFs are defined as
注意,势函数 可以依赖于整个 ,因为 只是一个条件变量。Note that the potential functions are allowed to depend on the whole , as is just a conditioning variable.
与贝叶斯网络不同,马尔可夫随机场需要显式的归一化常数 。因此,从一般马尔可夫随机场所表示的分布中采样,通常比贝叶斯网络的情形更为繁琐。一种常用技术是 Gibbs 采样。Contrary to Bayesian networks, MRFs require an explicit normalization constant . As a result, sampling from a distribution represented by a general MRF is usually more involved than for Bayesian networks. A commonly-used technique is Gibbs sampling.
本节回顾如何对如下形式的联合分布进行边缘推断与最大后验推断In this section, we review how to perform marginal inference and maximum a-posteriori inference on joint distributions of the form
其中where
其中我们用 作为 的简写,因为 与 是相邻的。如例 10.6.1 所解释的,这也可以通过令and where we used as a shorthand for , since and are consecutive. As explained in Example 10.6.1, this also includes Markov chains by setting
来纳入马尔可夫链,此时 。in which case .
前向—后向算法的关键思想,是利用乘法对加法的分配律,将其写成The key idea of the forward-backward algorithm is to use the distributivity of multiplication over addition to write
我们可以递归地计算这些和,既可以向前也可以向后。回顾式 10.1 中 和 的定义,我们定义上至和下至 的求和,We can compute these sums recursively, either forward or backward. Recalling the definitions of and in Eq. 10.1, we define the summations up to and down to ,
我们可以通过前向递归和后向递归来计算这两个量We can compute the two quantities by recursing forward and backward
其中我们定义了初始化where we defined the initializations
归一化项随后可由下式计算The normalization term can then be computed by
而边缘概率为and the marginal probabilities by
我们也可以通过下式计算条件概率We can also compute the conditional probabilities by
在实际中,为保持数值稳定性,这两个递归通常在对数域中实现,In practice, the two recursions are often implemented in the log-domain for numerical stability,
我们认出了 log-sum-exp 算子,它可以以数值稳定的方式实现(4.4.2 节)。整个动态规划流程,又称前向—后向算法 [13, 162],总结在算法 1 中。我们注意到,前向传播与后向传播实际上是彼此独立的,因此可以并行执行。We recognize the log-sum-exp operator, which can be implemented in a numerically stable way (Section 4.4.2). The overall dynamic programming procedure, a.k.a. forward-backward algorithm [13, 162], is summarized in Algorithm 1. We notice that the forward and backward passes are actually independent of each other, and can therefore be performed in parallel.
类似地,利用乘法对最大化运算的分配律,Similarly, using the distributivity of multiplication over maximization,
我们为 定义Let us define for
我们可以递归地计算这些量,因为对于 We can compute these quantities recursively, since for
其中 。最终我们得到with . We finally have
在实际中,为保持数值稳定性,我们通常在对数域中实现前向递归。利用对数函数的单调性,我们确实对所有的 都有In practice, for numerical stability, we often implement the forward recursion in the log-domain. Using the fact that the logarithm is monotonic, we indeed have for all
为了能够高效地回溯,在前向传播过程中,我们计算To enable efficient backtracking, during the forward pass, we compute
它可以被视为从 指向 的回溯指针。which can be thought of as backpointers from to .
所得的动态规划流程,又称 Viterbi 算法 [204, 69],总结在算法 2 中。The resulting dynamic programming procedure, a.k.a. Viterbi algorithm [204, 69], is summarized in Algorithm 2.
更一般地,当变量之间的依赖关系用树或多树表示时,可以执行基于动态规划的高效推断。所得的边缘推断与最大后验推断算法通常被称为和—积算法与最大—和算法。和—积算法也被称为信念传播或消息传递,因为它可以被解释为在图中传播“局部消息”。更多细节可参见例如 [206, 2.5.1 节]。More generally, efficient inference based on dynamic programming can be performed when dependencies between variables are expressed using a tree or polytree. The resulting marginal inference and MAP inference algorithms are often referred to as the sum-product and max-sum algorithms. The sum-product algorithm is also known as belief propagation or message passing, since it can be interpreted as propagating “local messages” through the graph. See for instance [206, Section 2.5.1] for more details.
本节回顾一方面对指数族分布的对数配分函数求导,另一方面执行边缘推断(以及零温度极限下的最大后验推断),二者之间的深刻联系。In this section, we review the profound connections between differentiating the log-partition function of an exponential family distribution on one hand, and performing marginal inference (as well as maximum a-posteriori inference in the zero-temperature limit) on the other hand.
我们首先讨论图模型文献中一个众所周知的事实:当以二进制编码作为指数族分布的充分统计量 时,对数配分函数 的梯度 汇集了所有边缘概率 [206]。We first discuss a well-known fact in the graphical model literature: when using a binary encoding as the sufficient statistic in an exponential family distribution, the gradient of the log-partition gathers all the marginals [206].
要理解其中的原因,回顾 3.4 节中指数族分布的定义To see why, recall from Section 3.4 the definition of an exponential family distribution
及其对数配分函数and of its log-partition
由命题 3.4.3,From Proposition 3.4.3,
因此,结合式 10.2 与式 10.3 中的二进制编码,Therefore, with the binary encodings in Eq. 10.2 and Eq. 10.3,
换言之,若已有计算 的高效算法,便可对 执行反向模式自动微分以得到 ,从而得到边缘概率。根据 8.3.3 节,计算所有边缘概率的复杂度因此与计算 的复杂度大致相同。Put differently, if we have an efficient algorithm for computing , we can perform reverse-mode autodiff on to obtain , and therefore obtain the marginal probabilities. Following Section 8.3.3, the complexity of computing all marginal probabilities is therefore roughly the same as that of computing .
在链这一特殊情形下,可得In the special case of chains, we obtain
其中我们隐式地保留了 、 和 对 的依赖关系。where we left the dependence of , and on implicit.
若定义 ,则在零温度极限 下可得, 是众数的二进制编码,亦即最大后验推断解的二进制编码。If we define , in the zero-temperature limit , we obtain that is a binary encoding of the mode, i.e., of the maximum a-posteriori inference solution.
下面我们说明:i) 如何利用半环与 softmax 算子统一前向—后向算法与 Viterbi 算法的前向传播;ii) 如何利用反向传播计算对数配分函数的梯度。We now show i) how to unify the forward pass of the forward-backward and Viterbi algorithms using semirings and softmax operators ii) how to compute the gradient of the log-partition using backpropagation.
前向—后向算法与 Viterbi 算法中的前向传播显然相似。事实上,二者可以通过半环在形式上相互关联。The forward passes in the forward-backward and Viterbi algorithms are clearly similar. In fact, they can be formally linked to each other using semirings.
我们采用记号 、、 和 ,以便与经典的加法、乘法、 和 清楚地区分开来。We use the notations , , and to clearly distinguish them from the classical addition, multiplication, and .
下面回顾二元运算的若干法则:We recall the following laws for binary operations:
的交换律:,Commutativity of : ,
的结合律:,Associativity of : ,
对 的分配律:。Distributivity of over : .
若一个集合配备一个满足结合律并具有单位元的二元运算,则称为幺半群;若其中每个元素都存在逆元,则称为群。环与半环的区别在于,后者只要求 和 构成幺半群,而不要求构成群。A set equipped with a binary operation supporting associativity and an identity element is called a monoid. A monoid such that every element has an inverse element is called a group. The difference between a ring and a semiring is that the latter only requires and to be monoids, not groups.
有了这些定义之后,我们便可以把 Viterbi 算法与前向—后向算法中的前向传播解释如下:Equipped with these definitions, we can interpret the forward passes in the Viterbi and forward-backward algorithms as follows:
指数域中的前向—后向算法使用半环 ,该半环配备 以及单位元 ;the forward-backward algorithm in the exponential domain uses the semiring equipped with and identity elements ;
对数域中的 Viterbi 算法使用半环 ,该半环配备 以及单位元 ;the Viterbi algorithm in the log domain uses the semiring equipped with and identity elements ;
对数域中的前向—后向算法使用半环 ,该半环配备 以及单位元 ,其中我们定义了软最大值算子(log-add-exp)the forward-backward algorithm in the log domain uses the semiring equipped with and identity elements , where we defined the soft max operator (log-add-exp)
默认取 。with by default.
可以验证, 确实是可交换的、可结合的,并且加法关于 满足分配律。其单位元为 。由结合律可得It can be checked that indeed is commutative, associative, and addition is distributive over . Its identity element is . By associativity,
相比之下,请注意 13.5 节中的 sparsemax 并不满足结合律。In contrast, note that the sparsemax in Section 13.5 is not associative.
得益于结合律,我们可以引入如下简写记号Thanks to associativity, we can introduce the shorthand notations
以及and
本节将说明,从算法角度看,回溯可作为反向传播的一种特例而得到。另见 [61, 132]。In this section, we show that, algorithmically, backtracking is recovered as a special case of backpropagation. See also [61, 132].
为简化记号,我们假设对所有 都有 和 。我们重点关注如下情形For notation simplicity, we assume and for all . We focus on the case
我们还引入简写We also introduce the shorthands
以及and
我们的目标是计算下式关于 的梯度Our goal is to compute the gradient w.r.t. of
该量的软 argmax 对应形式为The soft argmax counterpart of this quantity is
其中我们使用了 。where we used .
计算 的梯度与计算前馈网络的梯度类似,因为 不仅影响 ,也影响 。下面引入伴随变量Computing the gradient of is similar to computing the gradient of a feedforward network, in the sense that influences not only but also . Let us introduce the adjoint variable
我们将其初始化为which we initialize as
由于 直接影响 ,因此对于 、 和 ,有Since directly influences , we have for , and
由于 直接影响 (对于 ),因此对于 和 ,有Since directly influences for , we have for and
我们将这一流程总结为算法 3。前向传播使用 softmax 算子 与 softargmax 算子 。在硬 max 情形下,算法 2 用 存储从整数到整数的回溯指针;在软 max 情形下,算法 3 用 存储软回溯指针,即离散概率分布。在零温度极限下,反向传播给出的正是回溯解的二进制编码。We summarize the procedure in Algorithm 3. The forward pass uses the softmax operator and the softargmax operator . In the hard max case, in Algorithm 2, we used to store backpointers from integer to integer. In the soft max case, in Algorithm 3, we used to store soft backpointers, that is, discrete probability distributions. In the zero-temperature limit, backpropagation outputs a binary encoding of the solution of backtracking.
图模型刻画变量之间的条件依赖关系,从而指明其联合分布如何分解。Graphical models represent the conditional dependencies between variables and therefore specify how their joint distribution factorizes.
函数世界与分布世界之间有着清晰的类比:计算链与计算图,分别对应马尔可夫链与贝叶斯网络。There are clear analogies between the worlds of functions and of distributions: the counterparts of computation chains and computation graphs are Markov chains and Bayesian networks.
对指数族分布而言,链上乃至更一般的树上的推断,无论在统计意义还是算法意义上,都等价于对对数配分函数求导。Inference on chains and more generally on trees, for exponential family distributions, is equivalent, both statistically and algorithmically, to differentiating the log-partition function.
前向—后向算法可看作采用和—积代数,Viterbi 算法则可看作采用最大—加代数。等价地,在对数域中,前者可视为采用软最大值,后者可视为采用硬最大值。The forward-backward algorithm can be seen as using a sum-product algebra, while the Viterbi algorithm can be seen as using a max-plus algebra. Equivalently, in the log domain, we can see the former as using a soft max, and the latter as using a hard max.