Learning Dynamic Bayesian Networks from Data: Foundations, First Principles and Numerical Comparisons
Abstract
In this paper, we present a guide to the foundations of learning Dynamic Bayesian Networks (DBNs) from data in the form of multiple samples of trajectories for some length of time. We present the formalism for a generic as well as a set of common types of DBNs for particular variable distributions. We present the analytical form of the models, with a comprehensive discussion on the interdependence between structure and weights in a DBN model and their implications for learning. We give the analytical form of the likelihood and Bayesian score functions, emphasizing the distinction from the static case. We discuss functions used in optimization to enforce structural requirements. Next, we give a broad overview of learning methods and describe and categorize them based on the most important statistical features, and how they treat the interplay between learning structure and weights. We briefly discuss more complex extensions and representations. Finally we present a set of comparisons in different settings for various distinct but representative algorithms across the variants.
1 Introduction
In this paper we give a comprehensive presentation on the training of Dynamic Bayesian Networks (DBNs), including both structure and parameters, from data. DBNs present a naturally interpretable model when it comes to understanding the precise interaction underlying the relationship between random variables. That is, the conditional independence structure defined by the DBN provides information regarding the mechanistic procedure that defines the model. This is also associated with the field of statistics referred to as causal learning.
There is one general survey article on DBNs we found is [shiguihara2021dynamic], which provides a helpful comprehensive resource for references for DBN modeling, inference and learning. In this work rather than seeking to provide a comprehensive literature review, instead we focus on narrating the global landscape of the mathematical understanding of the most important considerations as far as learning a model, including both the structure and parameters, from data.
With this understanding we are able to establish an informative taxonomy regarding methods, providing transparency in regards to the function and intention of each approach. There are important subtle distinctions as far as modeling assumptions between some different popular methods, and their awareness is critical for best practices of DBN learning. Finally, we perform comprehensive numerical comparisons, highlighting the particular advantages and disadvantages of each method. We highlight that these comparisons are not meant to be exhaustive or authoritative, but more informative and illustrative in regards to the tradeoffs associated with learning DBNs from data.
We make several assumptions for this work. These are not entirely formal for the sake of precise Theorem proving, but rather a general restriction of the data generating process of interest, so as to highlight the most pedagogical features of DBN learning, as far as it is most commonly done in the literature. These assumptions are restrictive as far as faithful statistical modeling of real world phenomena. However, they tremendously simplify the learning process, and thus allow a more comprehensible presentation of what can one hope to achieve with standard simple methods. For transparency, we present them below:
-
1.
Causal Sufficiency There are no unobserved confounders, i.e., there is a closed system defining the data generating process wherein all causal sources are observed. This permits for the conditional independence structures to be reliable indicators of edge links in the graph. This is a standard formal assumption in almost all learning algorithms for DBNs and BNs.
-
2.
Causal Identifiability we focus on the general case wherein the data regime permits for potential identification of a true causal graph, generally corresponding to the number of data samples (trajectories time steps) some exponential factor of mangitude greater than the number of variables (in practice this can mean variables, trajectories of each time steps as a generic example). This permits us to focus on integer programming, constraint based methods, and other techniques that can obtain statistically significant point estimates for exact structures that recover a ground truth. This assumption is standard in the literature of DBN and SEM learning, as modeling uncertainty in less favorable data regime circumstances presents significant methodological challenges and considerations that require significantly more advanced techniques. However, understanding the nuances of the foundations are essential as far the proper development, implementation, and use of these techniques.
-
3.
Fully Observed There are no hidden variables, all quantities of interest are fully observed at every time step. Of course, graphs with hidden (latent) variables and entire structures are instrumental for modeling in many fields. However, the inclusion of latent variables and the required Expectation Maximization modification of the procedures described presents technical complications that add significant additional complexity, and thus would necessity a much greater length while obfuscating the message of the fundamentals.
We make a few departures from these assumptions throughout the work, which we explicitly indicate.
1.1 Contribution of this Work
In this work we present:
-
1.
A thorough explicit analytical description of standard popular DBN representations and statistical models. This includes the structure of potential dependencies of transition functions of the time-dependent random variables on other variables, time independent as well as time-dependent and in-time, Markovian one time step back, and delayed dependence.
-
2.
Extensive commentary and analysis of learning DBNs from data from both the classical PGM/BN perspective as well as the time series perspective. The relationship of learning to the structure of the data, as well as high level intuition on the complex interaction of learning the structure and the parameters is presented.
-
3.
A presentation of the most standard and common criteria for defining the objective or cost of a particular DBN network structure as well as the functional forms of equations that define that the graph satisfies the structural requirements of a DBN, in particular acyclicity
-
4.
Numerical results for examples of popular algorithms for learning DBNs, evaluated on a range of criteria and variety of problems. The set of examples is not meant to be exhaustive, nor the comparisons authoritative, but broadly illustrative of the relative advantages and disadvantages of the different methods available.
1.2 Applications of Dynamic Bayesian Networks
The discovery of dynamic Bayesian networks has found many applications, including medicine [Collett23, Eldawlatly08, lady22, Bueno16], economics [Ling15, LIU201946] and aviation [Matthews13, Valdes18, gomez18]. The applications related to aviation typically involve finding casual structure in a sub-problem on the dispatch of flights and focused on risk mitigation. The medical applications typically focus on either the discovery of fundamental principles concerning chemical reactions taking place in biological organisms or extracted clinical data. In economics, it is typically of interest to uncover relationships between the stock market and macroeconomic and other market indices that either influence or are influenced by it. In the following, we give some details about chosen applications as well as specific outcomes that modelling using DBNs has had in practice.
1.2.1 Medical Science
To highlight the importance of DBN-based discovery in medicine, we detail three separate applications. The first of these focuses on the quantification of disease development [Bueno16]. Understanding the progression of diseases is crucial in clinical medicine, as it informs the effectiveness of treatments. Most clinical medicine and pathology textbooks provide detailed descriptions of disease progression and treatment responses. However, there has been limited research quantifying these descriptions in detail. Typically, research examines the temporal aspect by describing treatment outcomes after a certain period. A significant challenge in gaining deeper insights is the relatively small size of clinical datasets, often comprising only a few hundred patients.
In the aforementioned contribution, a heuristic procedure is proposed for exploring and learning non-homogeneous time dynamic Bayesian networks, aiming to balance specificity and simplicity. The approach begins with a fully homogeneous (in time) model parts of which are gradually replaced with sub-models which reflect the expected structure change at a given level of time delay. Furthermore, a splitting technique is applied to further improve the predictive behavior of the model, such models are typically termed partitioned DBNs.
A heuristic method was proposed to learn the DBN on synthetic data, which has a structure that should reflect a real data set. The numerical performance in terms of accuracy and solution time reported is hopeful. However, the method has yet to be tested on real world datasets.
The second application is concerned with the mapping of neural pathways [Eldawlatly08]. Identifying functional connectivity from simultaneously recorded spike trains is crucial for understanding how the brain processes information and instructs the body to perform complex tasks. The study investigates the applicability of dynamic Bayesian networks (DBNs) to infer the structure of neural circuits from observed spike trains. A probabilistic point process model was employed to assess performance. The results confirm the utility of DBNs in inferring functional connectivity as well as the directions of signal flow in cortical network models. Additionally, the findings demonstrate that DBNs outperform Granger causality when applied to systems with highly non-linear synaptic integration mechanisms.
The third chosen application focuses on the choice of appropriate treatment regimens for Chronic lymphocytic leukemia (CLL) [lady22]. This cancer is the most common blood cancer in adults, with a varied course and response to treatment among patients. This variability complicates the selection of the most appropriate treatment regimen and the prediction of disease progression. The aforementioned paper aims to develop and validate dynamic Bayesian networks (DBNs) to predict changes in the health status of patients with CLL and predict the progression of the disease over time. Two DBNs, the Health Status Network (HSN) and the Treatment Effect Network (TEN), were developed and implemented. Relationships linking the most important factors influencing health status and treatment effects in CLL patients were identified based on literature data and expert knowledge. The developed networks, particularly TEN, were able to predict the probability of survival in CLL patients, aligning with survival data collected in large medical registries. The networks can tailor predictions by integrating prior knowledge specific to an individual CLL patient. The proposed approach is a suitable foundation for developing artificial intelligence systems that assist in selecting treatments, thereby positively influencing the chances of survival for CLL patients.
1.2.2 Economics
The relationship between the stock market and national economies deepens as the market matures, highlighting the need to study their dynamic interplay. Economic indicators such as real income and savings rates play crucial roles in influencing stock market capitalization. Macroeconomic fundamentals wield considerable influence over both short and long-term periods. Some researchers argue that finance and economic growth are causally linked, suggesting the stock market’s potential to drive economic development. However, not all macroeconomic factors significantly impact stock prices. Understanding the strength of association among these variables offers insights into how the stock market behaves across varying economic landscapes. Research on the Chinese stock market examines how macroeconomic variables shape stock market indices over time, emphasizing the enduring influence of economic fundamentals amid short-term market fluctuations. The aforementioned interplay may be modeled by DBNs and has been detailed in [LIU201946].
In the article and analysis of the relationship between the stock market and economic fundamentals using 11 selected factors is modeled using a DBN. Among these, four factors pertain to stock market indicators, while the remaining factors focus on macroeconomic and policy considerations. The first four factors reflect stock market performance, with defensive and cyclical stocks exhibiting varying behaviors during bull and bear markets. The Stock Exchange 50 index, comprising the 50 largest and most liquid stocks in the Shanghai Securities Market, supplements the overall stock market observation. Additionally, the consumer stock index serves as an indicator of societal consumption levels, typically rising during favorable macroeconomic periods and declining during economic downturns.
The results on real data of the described method are mixed. The application to the Shanghai composite market yielded some positive results in terms of the prediction of macroscopic quantities, but only limited success in terms of constituent market price prediction. The modeling of the components of the market in sufficient detail is a difficult problem due to the numerical tractability being limited as the number of variables increases.
1.2.3 Aviation
The global collection of aircraft and the airspace in which they operate is a complex system generating a vast amount of data, making it a challenging domain to model mathematically. This system includes critical elements such as aircraft, airports, flight crews, weather events, and routes, each with many subcomponents. For example, aircraft have numerous subsystems and components, each subjected to various stresses and maintenance actions, which influence their time dynamics. Airports have multiple runways and internal logistical processes, which influence the operational capacity. These system components interact in complex ways. For instance, each flight corresponds to an aircraft operated by a flight crew traveling from one airport to another via a route that may need to change due to weather. Multiple flights operate simultaneously, requiring coordination to avoid incidents while maximizing throughput and minimizing delays.
To give an idea about a specific aviation problem that may be tackled with DBNs, we describe the airport operation uncertainty characterisation developed in [gomez18]. The model outlines aircraft flow through the airport, emphasizing integrated airspace and airside operations. It characterizes various operational milestones based on an aircraft flow’s Business Process Model and Airport Collaborative Decision-Making methodology. Probability distributions for factors influencing aircraft processes need to be estimated, along with their conditional probability relationships. This approach results in a dynamic Bayesian network that manages uncertainties in aircraft operating times at the airport. The nodes of the network describe various aspects of the airport and flight operations. They cover meteorological conditions, arrival airspace variables such as timestamps and congestion metrics, airport infrastructure, operator and flight data, airside operational times and flight regulations, and the causes of delays.
The key outcomes of this work include the statistical characterization of processes and uncertainty drivers, and a causal model for uncertainty management using a DBN. Analyzing 34,000 aircraft operations at Madrid Airport revealed that arrival delays accumulate throughout the day due to network effects, while departure delays do not follow this pattern. The major delay drivers identified were the time of day, ASMA congestion, weather conditions, arrival delay amount, process duration, runway configuration, airline business model, handling agent, aircraft type, route origin/destination, and ATFCM regulations. Departure delays are significantly impacted by events of longer duration, which also offer greater potential for recovery.
2 Background - Dynamic Bayesian Networks
We present the general, and then specific forms, of DBN models. Consider that there is an -dimensional stochastic process . The individual random variables for all can be valued as discrete, or as members of some field, such as . In addition, there can be an -dimensional (time independent) random variable . Let us denote the generic spaces as and , respectively.
The defining character of DBNs is modeling the dependence of , for each , on other quantities, i.e., defining the the evolution of the stochastic process . Formally, for the probability kernel defining the iterations of the stochastic process, the dependence must be Markovian, with additional time lagged auto-regressive effects, that is
(1) |
where is some set in the Borel -algebra of . That is, the transition kernel can depend on the current state of the other random variables, the values of the random variables at the previous time, the time-independent variables , as well as a possibly autoregressive effect through dependence on .
In addition, there is the important requirement that no in-time string of dependencies, that is from to , forms a cycle. This presents the necessity of introducing graph theoretical notions to precisely characterize DBNs. Generically, we say a directed graph is a set of vertices and edges , where denotes the existence of a directed path between the two notes . We also say in this case that is a parent of , or .
The DBN model structure is defined by a graph superset,
(2) |
The first two union operands define connections in the model between the temporal random variables. That is with if the transition for , that is , is a function of , or in other words . For the static dependencies , and with and , it holds that if is a function of . Finally, we also have a (non-symmetric) matrix encoding the dependencies on the self-history and the dependencies on the static variables . These, of course, can be encoded as graphs as well. Generically, the autoregressive effects can include lagged influence across distinct random variables, however for simplicity we focus only on including self-dependencies for time lags longer than one.
This permits us to write (1) as,
(3) |
Notice that the encoding of the explicit dependencies presents the possibility of using a common as opposed to one depending on the transition out-node , in the case wherein all the variables are of the same distributional family. This eases the computation of the likelihood of the data given the parameters and structure, etc.
We will sometimes use, for shorthand:
(4) |
![Refer to caption](extracted/5823809/DBNModel.png)
See Figure 1 for an illustration of a DBN and its transition dynamics. In this case for , the Markovian transitions are from itself and from , and there are no intra time nodes or static nodes directed to it, and so . For node 2, there are no Markovian transitions and two intra-node dependencies, thus . Finally, for , there are two Markovian dependencies, and a static covariate dependence. Thus .
Now that we have established the general form of the DBN, we see that we have a fundamentally still very general problem to solve, in that the function can encode any sort of dependency on the different variables in the parent set of the note of interest. They can depend as according to various nonlinear interactions, that can themselves embody different conditional independence information In order to complete the model, we need to define the form of the function .
2.1 Simple Parametric Conditional Probability Dependency
For certain kinds of variables, it becomes both possible and prudent to use certain simple parametric families for defining . For instance, for binary Bernoulli random variables, the use of Dirichlet distributions for the prior of the weights together with using Conditional Probability Tables to define the form. For continuous random variables, Gaussian linear models provide a means of computing the maximum likelihood linear parameters using covariance matrices.
A significant advantage of using parametric families arises from the closed form computation of criteria, which permits closed form computation of the marginal posterior of a structure. This permits structure learning algorithms to be able to score graphs offline, assisting in the search. Many score maximizing procedures such as [geiger2002parameter, cussens2020gobnilp, BARTLETT2017258, atanackovic2024dyngfn] use this approach. The score is ultimately an integration of the posterior of the parameters in the model given the structure, which also indicates that the sampling of the optimal parameters, once obtaining the maximum a posteriori structure, is straightforward for these models.
With the optimal parameters and likelihood computation amortized, one can then use black box approaches such as those involving neural models. This includes the innovative Generative Flow Network approaches as given by [pmlr-v180-deleu22a, atanackovic2024dyngfn]. These use a Reinforcement Learning iteration to ultimately sample from a high scoring network as according to a defined score. Reinforcement Learning broadly, e.g., [zheng2023rbnets] is another framework by which the structure search for these standard specific models can be aided by neural networks.
Linear Structural Equation Models (SEMs) present an opportunity to use an adjacency matrix to define both the structure and weights in a computationally advantageous form. This highlights the correspondence between the Dynamic Systems and the graph theoretic developments in causal learning.
2.1.1 Discrete Variables
Binary Variables
The case of binary random variables is wherein , etc., that is, they are all of Bernoulli type. Empirical samples for all , where indexes a set of sample trajectories satisfy for all , , and . With this most simple scenario, the modeling flexibility as well as the nuances of structure learning becomes a natural pedagogical start.
There is a degree of flexibility in the choice of statistical model for defining the transition function. We will explore three options - the noisy or model, the linear logit model, and the complete dependency table model.
The noisy or model defines the transitions as
(5) |
This model is referred to as noisy or because essentially it calculates a probabilistic perturbation of the binary OR operation. This model presents one implementation of causal independence, wherein the influence of each covariate is independent with respect to the others.
For the linear logit models, define the sigmoid function,
The reason the models we define next are referred to as linear is that the transition is defined to be,
(6) |
We shall see that this linear form is broadly common in modeling the transitions of variables in DBN models for other variable types.
One alternative that frequently arises in practice is the necessity to accurately model Conditional Probability Dependencies (CPDs) as defined by Conditional Probability Tables (CPTs). As an example, please see Table 1.
0 | 0 | 0 | 0 |
0 | 0 | 1 | 1 |
0 | 1 | 0 | 1 |
0 | 1 | 1 | 0 |
1 | 0 | 0 | 1 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 0 |
1 | 1 | 1 | 1 |
It is clear that the information in Table 1 cannot be modeled with a linear transition function as in (6). In this case, if one wanted to construct such a model, one would instead have to be able to include all of the combinations between the possible parent nodes.
Formally, a transition model could look like, for Table 1,
and in the general case,
(8) |
where the parameters are appropriately normalized. With the combinatorial explosion in this model clearly visible, it can be seen that such circumstances present significant difficulties as far as computing hardware expense in both processing and memory, when it comes to modeling high dimensional datasets.
On the other hand, this structure of statistical model presents two structural conditions denoted as local parameter independence and unrestricted multinomial distribution [spiegelhalter1990sequential]. These ensure that for every configuration, that is, every possible combinations of values of the parents of a node, there is an independent parameter vector. This leads to a corresponding combinatorial explosion of parameter vectors in the statistical model. On the other hand, however, the analytical calculation of parameter likelihoods and posterior distributions become possible, facilitating more straightforward evaluation of scoring metrics quantifying the information quality of an entire (D)BN. That is, the marginal likelihood of a structure can be computed without first computing the likelihood of the weights.
Multinomial
Multinomial distributions are over discrete valued random variables that can take on multiple possible values. The distinction between a user friendly linear parameter presentation and the expressiveness at the cost of parametric dimensionality of unrestricted multinomial distributions becomes apparent in the increased complexity of modeling multinomial relative to Bernoulli distributions.
Now, consider that for every , some multinomial sample, with Dirichlet sampled initial values, and always with some multinomial distribution . The set of parameters indicating the probability that given a particular configuration of the parent nodes is denoted .
First, consider a linear model. Let us simplify the notation,
With this, the form of the transition probability is,
(9) |
which is a standard linear logit.
On the other hand, with an unrestricted multinomial distribution, we can define the full transition distribution explicitly, meaning for every possible combination of values instantiated by a node’s parents in a given network, we define a specific probability. In this case even the already cumbersome notation of (8) is insufficient to present the model representation. On the other hand, we will see that this representation eases the likelihood and Bayesian score computations. Finally, we distinguish as the time-dependent and time-independent covariates. We also distinguish the possible values of to be
We simply denote:
(10) |
That is, there is an multi-index that enumerates the entries of for each transition . We can see that this presents a highly parametrized model, which will imply significant parametric uncertainty when there are finite data samples. On the other hand, with this highly precise model, the maximum likelihood becomes much more straightforward to compute, as well as the Bayesian scores. Indeed, this is exactly what local parameter independence facilitates – you can compute the likelihood by counting the instances of each transition and dividing by the count of each predecessor configuration. On the other hand, when the total count of every possible predecessor configuration is low, due to unfavorable sample complexity, this can be a rather noisy source of actual validity of that dependence. On the other hand, by letting these parameters take on distributions, in a Bayesian setting, the computation of a posterior for a structure becomes easier, and the uncertainty is available by sampling the posterior, anyway.
2.1.2 Continuous Variables
Gaussian Variables
A Gaussian Bayesian Network can be considered a continuous variable equivalent to binary variables in the sense that the structure permits closed form expressions for computing the likelihood, posterior, etc. In this case, however, the additive linear term is standard. Formally, we assume that . The transition function becomes:
(11) |
and the result is that,
Indeed in [koller2009probabilistic, Theorem 7.3-7.4] it is shown that there is a bidirectional equivalence between such a normal joint distribution and normal transition function.
We shall see that this permits, in the temporal case, a repeated composition of the propagation of the covariance with each time step, when computing the likelihood and performing inference. This is associated with the deep theory of filtering methods, which typically studies Gaussian DBN propagation with a simple state-observable structure.
Exponential Family Functional Form
An exponential family is defined with, recalling to be an abstract space for which both ,
-
1.
A sufficient statistics function for some
-
2.
A convex set of a parameter space
-
3.
A natural parameter function
-
4.
A measure over
The exponential family is a distribution of the form
(12) |
The case of natural parameters is the most standard, and the one we have been exploring in the formulations above, this corresponds to . One has to be careful, however, in constraining the space of parameters to ones normalized, i.e.,
Linear Structural Equation Models
Consider the general case wherein the function , as given by (1), is given a linear parametrization with respect to continuous variables , as in (6), however for continuous variables. One can then perform learning by minimizing the appropriate least squares fit to the data. This is most common in the approach of Linear Structural Equation Models, in which case a linear parametrization permits greater computational ease.
Linear Structural Equation Models (LSEMs) are the most common non-Gaussian DBN for modeling continuous variables. With LSEMs (see, e.g. [bowen2011structural] for a general reference and [peters2014causal] for application to causal inference) presume a general linear structure that is associated with a discretization of a dynamical system:
with this generality, there is a degree of ambiguity in the literature, because there are a number of ways to consider a discrete model of this.
An SEM could refer to a purely time-instant (static) model, with dependencies and only, as in [pmlr-v180-deleu22a, manzour2021integer]. More recently, DBNs more broadly have become interchangeable with SEMs, for instance, the representation in [pamfil2020dynotears] has all dependencies as described here except, it can be argued for simplicity, .
Nonlinear, Nonparametric and Neural Models
The structure of , or even if there is an at all, is of course flexible like with any statistical modeling. More complex statistical models for the transition introduce significant additional difficulties in training, by adding nonconvexity to the landscape and significantly expanding the degrees of freedom in the model that need to be fit with data. Given the emphasis in this article on simple illustrative DBNs, we will but briefly mention some examples, neither comprehensive nor authoritative.
Broadly speaking, there are a number of popular parametric forms of nonlinear models that can be used from time series literature, e.g. [douc2014nonlinear]. Neural networks have enabled computationally intensive empirical unsupervised time series models [franceschi2019unsupervised, cai2024msgnet]. Simple nonlinear functional models in the SEM statistical community have also been studied [lee2000statistical]. The work [sharma2022scalable] uses splines to model the nonlinear relationships in the transition distributions. The work [kim2004dynamic] uses a kernel nonparametric regression model to learn DBNs for gene regulatory networks.
3 Learning From Multiple Trajectories
Consider that we receive samples of trajectories , each with a total time of
(13) |
and we are interested in fitting a DBN model to this data. This amounts to defining the specific form of in (1) and as far as three tasks, as defined in the introduction. More specifically, it amounts to
-
1.
identifying the parents of each in the graph , as well as specific functional form of the transition function , of a ground truth
-
2.
Performing inference on the model accurately. For DBNs a common use is for forecasting, but generalization and test error is another common metric.
3.1 Maximum Likelihood Calculations
In reviewing the literature on learning DBNs from data, it is typical to disregard the distinction of the trajectory sample and the time transition samples . As far as understanding the meta-methodological cause of this, it appears that this can be said to be due to DBNs being considered not uniquely, but as either a special kind of Bayesian Network, or as splices of the same time series trajectory.
Consider the two methodological components surrounding the study of DBNs, time series analysis and PGMs. For the latter, consider two popular works that are effectively extensions of methods developed for BNs extended to DBNs, the continuous reformulation of the problem into one with adjacency matrices as decision variables, called “NOTEARS” in the static case [zheng2018dags] and “dynotears” [pamfil2020dynotears], as well as the use of “Generative Flow Networks”, a Reinforcement Learning-motivated sampler, for the static case in [pmlr-v180-deleu22a] and the dynamic case in [atanackovic2024dyngfn]. It can be seen that in all of these cases, the likelihood is expressed as,
(14) |
and with the standard application of the logarithm, change into a sum, and maximization, or a posteriori maximization through a Bayesian criterion, as the target.
And similarly, in consulting standard texts on time series analysis with detailed derivations of Likelihood computation for various models, e.g. [douc2014nonlinear, mcquarrie1998regression], we see that in the derivations of the likelihood, the data is considered to be a sequence of observations, that is, a sequence of observations from a stochastic process , rather than the general form given in (13), and is fit to (14), just with a simpler expression in the sum index. However, arithmetically, the calculations commute, that is, they are equivalent to the Bayesian Network paradigm. Being equivalent expressions for the likelihood, brought from different perspectives, we can see that the conditional nature of each sample makes the concern as to the appropriate application of the methods to be less as to whether they can adequately computed with sound statistical assumptions, but care as to what one can learn, i.e., learning conditional dependencies rather than long term statistical properties.
3.2 Background on Causal Learning
Conditional Independence and d(irected)-separation
Let be a (D)BN. Let be the set of random variables of (D)BN. Let be subsets of . We say that the set is conditional independent of given if the following condition holds:
Independence of various sets of variables can be determined by examining d-separation (d means directional) criterion of the (D)BN DAG [ProbabilisticCowell].
A (undirected) trail (path that does not contain any vertex twice) of is blocked by the set if either (i) , and in-degree of is at most 1; (ii) and , and both arcs of connected to are directed to . The sets and are d-separated if any trail between and is blocked by the set . If and are not d-separated, we say that they are d-connected.
The set is conditional independent of given , if and are d-separated by .
Causal Sufficiency
We present the main set of definitions used in the literature from [???, beckers_causal_2021].
A signature is defined as a tuple , where is a set of exogenous variables, is a set of endogenous variables, and is a function that maps each variable in to a nonempty set of possible values, representing the range of values can take. For a vector of variables , represents the Cartesian product .
A causal model consists of a pair , where represents the signature and specifies a set of functions. Each function in associates an endogenous variable with a structural equation , which determines the value of based on the values of other endogenous and exogenous variables. Formally, the function maps to , meaning that provides the value of given the values of all other variables in the set .
Definition 3.1
We say that is directly sufficient for if for all and all it holds that .
Definition 3.2
We define that is strongly sufficient for if there is an such that and is a restriction of to and is directly sufficient for
Definition 3.3
We define is weakly sufficient for in if for it holds that
Causal discovery and Inference
The problem of Causal discovery is to find a true graph as the best possible explanation of the given data. There are various causal discovery methods. Such as score-based algorithms, which try to recover the true causal graph by finding a graph that maximize a given scoring function. Another example are Constraints based algorithms or continuous optimization algorithms.
3.3 Considerations from Axioms of Causal Learning
DBNs, compared to BNs, contain both time-varying as well as static variables. While the in-time transition structure is still a DAG, suggesting that formally many of the same principles regarding inference as well as structure and weight learning in BNs carry over to DBNs, the presence of time, especially when long trajectories are expected, adds significant complications.
Consider having a set of sampled trajectories. On the one hand each trajectory is i.i.d., but above that, each time point relative to the previous presents an additional sample, with additional information. This presents the question: how can we distinguish the amount, and specific utility, of information gained from an additional trajectory, versus that gained from an additional time point?
This indicates the utility of including both static and dynamic variables in the model for elucidation. Instead one can consider a new trajectory as a new sample of , which itself samples then, . As such, one has samples in order to learn . However, what can be said about how informative a marginal trajectory is towards learning , that is, the marginal conditional over the population of ?
It seems intuitive that in some way as well as should weigh the in, where is the population prior of , corresponds to the information gained for . For continuous variables, the information depends on the cross correlation as the prior evaluation is perturbed. It is clear then that information complexity is actually benefited from low variance, or low cardinality of a discrete space, between trajectories. Thus, the DBN model is particularly suitable for understanding long and complex time evolution of systems that do not change much in different contexts.
Recall that causal sufficiency requires that all confounding variables be present and observed. It is clear that different trajectories represent some distinctions in circumstance of object that the observations are taken from. If this is a latent variable, this presents an insurmountable probably to identification.
As far the required observations for causal identification, this is that there exists at least one such that for all trajectories is observed, and is in the parent of some . We can consider that the classic Randomized Clinical Trial is exactly that and then testing for , with a null and alternative hypothesis and as other covariates, assumed to me completely independent of .
The less that mediates the transitions, the more the trajectories can be treated as independent.
3.4 Closed System Graph Causal Identification Model and Likelihood Information
In an effort to establish appropriate first principles by which to study the computational and statistical properties of joint structure-parameter learning in DBNs, we will present two definitions of specific setting and problem. In this first case, we consider the more mathematically convenient circumstance of causal sufficiency, or more broadly, a closed system whereby all of the forces and mechanisms influencing the random variables are either observed, or are ultimately latent variables that are completely determined by observed variables.
Closed System Graph Causal Identification Model: Assume that are random variables whose interdependencies are fully described y some theoretical DBN defined by a graph and , there is defined as the transition function given by
wherein is a zero mean error term. This additive noise model formulation has been leveraged to establish results on the identifiability of the structure [peters2014causal, hoyer2008nonlinear].
The statistical task is as follows:
-
•
Frequentist: Given , identify the correct ground truth and a set of parameters that maximizes the likelihood of the data given the model, .
-
•
Bayesian: Given and some background prior uncertainty knowledge over the structure and parameters , find the a posteriori distribution over the graphs and, hierarchically, the weights .
As , it is known that standard scoring and likelihood metrics enable recovery of the ground truth structure and parameters . However, with the superexponential scaling of possible graph structures
Finally, let us investigate in more detail the information regarding the DBN dynamics given by (14).
Consider that we have two observed trajectories for three time steps, that is,
We know the trajectories themselves are independent, so we can write the likelihood as a product. The critical consideration now is the treatment of the starting value . It can be taken as an exogenous variable, which would place it in the same role as the conditioned parameters and . Alternatively, a prior of would specify that a particular DBN is associated with certain starting points. However, notice that we must add an additional parameter , which would functionally play a similar role as simply conditioning on itself. So, likelihood can be written to be of the form,
However, the latter transitions are independent given the starting point, suggesting that arithmetically we are indeed back to (14). So this is technically correct.
In order to see why this is still consistent with the intuition that trajectories should have a greater degree of independence, let us continue rewrite the likelihood:
Continuing this through, we can see that as , the expression becomes
from which we can see the intuition of the circumstance. Asymptotically, the second term approaches the stationary distribution, and the independence assumption becomes valid. Indeed, the structure of the DAG and overall model is expected to be such that the system is long run ergodic. Otherwise, we can consider that for much longer than the mixing time, this assumption is also valid for most of the transitions. For shorter times of trajectories we can see that:
-
1.
The larger the measure of the support, and the more distinct the starting points are from each other, the longer it can take for the stochastic process to mix to erase the information from initial conditions.
-
2.
In finite time, the influence of history will depend on the conductance of the Markovian process defined by , that is,
(15) where,
where could be any predecessor in the graph for .
This appears in the previous likelihood as follows: we are actually not learning generic trajectories, but those associated with the history of the trajectory, since we are learning conditional distributions. So, in the previous calculation, under the most unfavorable scenario, and would correspond to different regions of state space for , that is and , for some large , and we learning completely independent transitions that don’t inform each other, and moreover, with low spatial correlations, the information gained in the marginal is proportional to .
We can finally conclude from this analysis that the distinction in time transitions and trajectories is only relevant as far as which conditional dependencies they present. Fundamentally, the overall population prior observed for the conditioned variable determines the usefulness of the observations for learning statistical long run averages of the process.
3.5 Sample Complexity for Forecasting
Where the intuition described above arises is in recent results in sample complexity. We shall see that while the arithmetic of (14) is still correct for DBNs, there are indeed important distinctions on the sample complexity with respect to the number of different trajectories and the length of the trajectory in certain data regimes.
Classically, theoretical analyses of time series sample complexity typically assumed that the trajectory is much longer than the mixing time and by cutting the synthetic burn in period, as such obviates any need to analyze historical dependence. (see the review of the previous results in [tu2022learning])
We shall report on the theoretical small sample complexity results reported in [tu2022learning], which is yet unpublished but extends and otherwise mentions similar recent results in [xing2022identification, xin2022learning, zheng2020non, dean2020sample].
They derive the sample complexity results for learning and identifying a dynamic system,
(16) |
which can be seen a simple Hidden Markov Model and are i.i.d. normal random variables. With a goal of fitting a test trajectory of length (that is, not necessarily equal to ), i.e.,
with a minimax risk, i.e., minimizing, algorithmically, the maximal risk associated with the worst case population subsample . They compute the guarantees associated with the least squares solution, as defined by the specification of (14) to the form given in (16), with a least squares loss, i.e.,
Finally, they require a trajectory small-ball assumption, that can be understood as a uniform bound on the covariance matrices associated with the noise in the sequence.
With this, they present three major results, which are restated here in their informal form.
Theorem 3.1
[tu2022learning, Theorem 1.1-3]
-
1.
If , , and the trajectories are drawn from a trajectory small ball distribution, then the excess prediction risk over horizon length is
-
2.
If , and is marginally unstable and diagonalizable, then the worst case excess prediction risk over horizon length is
-
3.
If and covariate trajectories are such that is marginally unstable and diagonalizable, then the worst-case excess prediction risk over is
From this Theorem, we can consider that with enough samples, standard rates of sample complexity treating the trajectory length and the number of trajectories apply. However, for large relative dimension size of the variable space, the complexity does not scale as well, but is similarly proportional. Finally, when attempting to fit longer trajectories , we finally see that there is greater benefit towards obtaining data samples with long trajectory lengths over sampling more trajectories.
We report on the one prominent result as far as learning so as to achieve accurate inference on BNs. The classic work [dasgupta1997sample] reports on a sample complexity, in VC dimension analysis, of modeling a Bayesian Network to be,
where suppresses multiplicative terms of , and define the probability of an inference within a small distance of the true outcome, is the number of variables, and is the number of potential parents.
3.6 Sample Complexity for Identification
The sample complexity given above is for a measure of forecasting error, i.e., excess prediction risk formally. As noted in the Introduction, DBNs are used for a number of purposes. This includes not just forecasting, but also identifying a graph structure that is an interpretative model of potential causal relationships between variables.
To the best of our knowledge, there are no sample complexity results on graph and causal discovery identification which take separate consideration of trajectories and time steps in the data. Instead we report on a few general recent results on the overall sample complexity for learning a (D)BN as well as a recent result on causal discovery specifically.
In general, identifying the Bayesian Network is NP-Complete with respect to the number of variables [chickering1996learning]. It is noted that the number of possible DAGs for 10 variables is greater than 41018 [peters2017elements].
There are some additional sample complexity results worth reporting from the literature.
The work [ordyniak2013parameterized] presents poly-time identifiability in the case of bounded treewidth or acyclic super-structure, and otherwise confirms NP-Hardness of search with respect to data. A creative recent work [geduk2022practical] uses models from physiology to argue for practical complexity, with the cardinality of a discrete valued network and is the number of potential parents.
More favorable results are presented for linear SEMs with a recent algorithm that improves the sample complexity to in the case of sub-Gaussian errors and for -bounded moment errors.
Finally, the work [wadhwa2021sample] considers sample complexity of causal discovery specifically, which runs at the number of samples required being , where is the cardinality of the possible random variable values in a discrete network.
3.7 Formalization: Open System Forecasting Model
In practice, in many cases wherein DBNs are employed for modeling, understanding and forecasting, the underlying system is not completely closed, as in a physics experiment, or deliberately marginalized, as in a randomized clinical trial. Instead, it models a complex and often infinite dimensional system, with intricate and impossible-to-know interactions with the environment. With the presence of unknown confounders, causal sufficiency isn’t satisfied. Moreover, it can happen that multiple structures and parameters become equally effective at accurately modeling the process, even highly distinct ones suggesting distinct causal mechanisms.
For instance, DBNs are often used for predictive maintenance, as in [amin2019fault, yu2013novel]. By an appropriate representation of the underlying complex engineering system as distilled into some low dimensional latent structure, one can develop DBNs to monitor signals of deterioration or damage in the system as based on the historical transitions over time in performance.
An interesting formalism of this is given in [esmaeil2015dynamic]. For some underlying stochastic process with (e.g., Brownian) noise where is very high, if not infinite, dimensional, one can consider a DBN model as a finite dimensional reduced order model of the system, and one that maximizes the information relevance towards maintenance. Formal guarantees are provided as far as probabilistic invariance, that is,
indicating the potential for DBNs to serve as useful indicators of higher level properties of stochastic processes, regardless of the fundamental impossibility of formal causal structure identification in such cases. These considerations, and the study of DBNs without causal sufficiency in general, is broadly limited, however.
4 Learning, Loss Criteria and Constraint Definitions
Now we will proceed to present some of the analytical expressions associated with learning DBNs. Recall that we assume we have a sample of trajectories over time horizon , that is, we restate (13),
4.1 Criteria
In order to ascertain the goodness of fit of different DBN graph structures, a score function serves as an objective in an optimization process. The score function is meant to evaluate the statistical accuracy of a model together with its parsimony. In performing structure learning as guided by a score, we are performing a likelihood, or some maximum a posteriori maximization, in the process of traversing the decision landscape of structures.
Selection criteria for models appears in both the BN/PGM as well as the time series modeling literature. In [mcquarrie1998regression] a thorough exploration of the evaluation and computation of various criteria is presented for a range of different time series models. In [douc2014nonlinear] it is recommended to use a general form for an information criterion to evaluate possible networks is, for samples (not distinguishing between trajectories and time points) and a total parameters:
(17) |
where is the likelihood of the data given the model and parameters and is a parsimony term with the following forms:
-
•
AIC
-
•
AICc
-
•
BIC
From an alternative perspective, we consider how the Likelihood can be computed and maximized. Writing the quantity as we see that it depends on both the structure and the parameters . Observing that 1) the parameter space itself depends on the graph structure, and 2) the likelihood is differentiable with respect to the parameters whereas the structure is a discrete quantity that presents, fundamentally, a combinatorial optimization problem.
A natural approach, which can be described as a sort of hierarchical frequentist method, would be to maximize with respect to . In doing so, however, to evaluate the likelihood given , one must compute that is,
where conditioning on enforces the appropriate structure of to be zero. Computationally, one can also pursue a one shot approach wherein the structure and weights are maximized simultaneously, with some appropriate functional enforcement of consistency of the structure with the zero sparsity structure of weights. While formally, a global maximum obtained with a hierarchical procedure is going to be the same equivalent pair , in practice the choice does carry a distinction as far as tendencies and patterns of the solutions of the optimization procedure.
From a frequentist perspective, the term is a regularizer chosen instrumentally to prioritize sparser solutions. Sparse basis recovery has long been an important area of statistical research (e.g. [wainwright2009information], with a popular monograph (with a chapter on PGMs) [wainwright2019high] (see also [wainwright2008graphical]).
In taking a Bayesian perspective, one can consider a functional / computational equivalence by considering as the prior, with varying strength corresponding to the degree of confidence in the prior. Formally, the score function is the marginal posterior of the candidate structure given the data, that is . This, of course, is unknown in form but can be appropriately decomposed with the parameters serving as “nuisance” vectors, i.e.,
For particular kinds of parametrized DBNs, computing this posterior can be done in closed form without evaluating explicitly the terms involving . For a classic discussion on the statistical intuition, motivation, and some formulations of Bayesian criteria, see [heckerman1995learning].
4.2 Likelihood Calculations
A common assumption made in the literature [koller2009probabilistic, geiger2002parameter] is that of global parameter independence. That is, it holds that the parameters can be decomposed to be separable across the transitions for each variable , i.e. using the notation to indicate parameters associated with the transition step for variable ,
Assumption 4.1
It holds that,
and that, for any data sample ,
This assumption significantly eases computation, as the solution can be obtained by maximizing the likelihood for the set of parameters separately for each . Now, to obtain the expression for the total likelihood in this case, perform the usual condition dependence chain
This yields the complete expression below, where we now include all the structured dependencies.
(18) |
We will also use to indicate the variables corresponding to the set of dependencies
4.2.1 Binary Variables
In the case wherein all variables are valued sampled from a Bernoulli distribution, this presents the simplest calculation, recalling the definition of the transition model.
More significantly, here, we shall see that the more complex representation permits for closed form computation of the marginal posterior of the structure.
To begin with, the simple linear model (6). In this case we write,
From this functional form we can obtain, recalling generically for any parents, by any of the dependencies, of the variable .
(19) |
Now we take a logarithm of the expression, turning the products into sums,
(20) |
In this case, the maximum likelihood cannot be computed in closed form, and numerical methods must be used. The similar situation holds for computing a Bayesian score under this model restiction.
Now we consider the full combinatorial representation as defined by (21), which, with binary outcomes, simplifies to:
(21) |
Indeed this corresponds to the local parameter independence and the unrestricted multinomial conditions that facilitates the closed form computation for the Bayesian Dirichlet scores. To this end, we now extend the presentation in [heckerman1995learning] (see also [heckerman2008tutorial]) to include the contribution of the static variables to the model.
First we begin by writing the full expression for the likelihood and computing the likelihood-maximizing parameter values, making use of the modeling representation in (21).
We introduce one more piece of notation, indicating the set of dynamic variables that contribute in the DAG structure to node ,
this distinguishes the dynamic variables from the static ones.
(22) |
Let be the counting operator of the number of elements of that satisfy the condition given by . Now take the logarithm of the likelihood expression and obtain a sum-separable set of terms for the log likelihood of each parameter, and perform generative learning to find the parameters. Specifically,
From which the natural maximum likelihood estimate can be formed:
(23) |
Note that in this case, the counts are over both the samples of trajectories and the time points between them. Observe the role of the static variables as simply interacting covariates in the form. Thus, when is of a mechanistic form that mediates the transitions, its influence is absorbed as simply an added dimension to the parameter space. We can, however, force a distinction between dynamic and static effects if we assume their causal independence. This would correspond to a kernel transition of the form:
(24) |
where denotes the full set of time-dependent variables that influence . It can be seen that we can obtain the maximum likelihood estimates as,
(25) |
From this we can see indeed that with independent causal influence, the estimate for the parameters governing the static nodes ’s influence carries more statistical power, with an effective sample size scaled by .
Now we present the computation of the Bayesian Dirichlet scores. This amounts to computing the marginal posterior of the structure by performing an integration treating parameter as nuisance. This is derived, for instance, in [geiger2002parameter], and used in the popular integer BN structure learner GOBNILP [cussens2020gobnilp]. The marginal posterior of the structure is given by:
In order to compute the BDe, we need a prior on the weights, which we write as a Dirichlet distribution,
Recalling the expression for (22), we can see that the BDe can be computed by,
where
and with dynamic-static causal influence independence, the score becomes,
(26) |
Thus, for the DBN case, computing the above amounts to evaluating the BD score. We observe, in addition, that this derivation indicates how one can sample from the posterior distribution of the weights given the structure that a learner identifies as maximizing the desired score. Indeed the posterior of the weights given the structure is shown above, it is the expression under the integral sign, i.e.,
(27) |
4.2.2 Gaussian DBNs
Now we present the derivation of the likelihood and Bayesian criterion (BGe) for DBNs with Gaussian models. The development follows [geiger2002parameter] and extends their derivation in two ways. First we perform the recursion for computing the entire trajectory time data. Second, we include a specific parametrization and show how one can simultaneously perform the recursion to obtain a posterior of the weights. We, however, simplify our model to only include Markovian influence, and not lagged autoregressive effects.
We apply the model in [geiger2002parameter] to (11) to obtain the following transition likelihood function for the first step and prior for both the overall likelihood transition and the parameters themselves:
(28) |
Now consider that the variables have corresponding priors marginal:
(29) |
this will be also used to derive the corresponding equivalent posterior analysis. Note that the DAG structure is important for the sensibility of these definitions.
Let us define . The parameter prior introduces a normal-Wishart distribution on the mean with precision matrix , dropping the dependence
(30) |
where denotes the Schur complement of with respect to . In [geiger2002parameter, Theorem 4 and Theorem 5] it is shown that parameter independence is preserved through the computation of the posterior. Note that the posterior now is with respect to all the data that is present in a transition. The DAG structure ensures that is well defined as a vector, rather than implicitly as a function of . Finally, the last line related the two models together, indicating how the Wishart distribution arises from the parameter distribution, in this case.
With this, we obtain the joint likelihood expression:
(31) |
for mean and nowhere singular covariance matrix .
Now, with this redundant embedding in both prior in the variable space and parameter space, we deduce how to compute the posterior of the distribution distribution of the data and from [geiger2002parameter] for , and subsequently, compute the posterior of the parameters in the model, while showing it is equivalent by a straightforward Bayesian posterior propagation. After deriving the base case , we continue with the induction for to , in order to derive the final posterior of the data, from which we can compute the marginal likelihood of the structure, as well as sample the final posterior values.
Now from the original we know that the likelihood of the data can be given by:
(32) |
Now, before we proceed with the next time step, let us define the propagation in the hyperparameters, that is of the model .
(33) |
Recalling that, and the block mean vector and covariance matrix components corresponding to the estimates for , respectively, can be similarly computed through .
We now perform the grand inductive step, to obtain the recursion from to to be as follows, for the posterior of the data:
(34) |
In general terms, the form is broadly preserved. As such, we can reproduce the evaluation for the marginal likelihood, that is the BGe score, directly from [geiger2002parameter]
(35) |
where are maximal, or the appropriate weighted average, of the sparsity of dependence on covariates on the transition to (that is, the dimension of ).
We can also express the parametric form of the posterior of the distribution of the weights, which also follows along the recursion.
(36) |
This defines the distribution of weights. Note that obtaining the score from the weights can be done straightforwardly as well, as then can be recovered from , and then will have mean
4.3 Enforcing Acyclicity
For ensuring that the structure that is learned is a proper Directed Acyclic Graph, there are a number of options as far as formulations for the various optimization problems defining the learning. Below we detail how these are enforced both when the structure is defined by integer decision variables as well as the continuous one shot formulation.
Integer Variables
The primary challenge in solving optimization problems on DAGs stems from the exponential size of the acyclicity constraint. A well-known method to ensure acyclicity involves using cycle elimination constraints, which were originally introduced in the context of the Traveling Salesman Problem (TSP) in [chvatal10]. Supposing that the set of all cycles is denoted by , these constraints often take the form
(37) |
where denote binary decision variables that indicate which edges are present in the directed graph. These constraints may be complemented by different score functions to complete the optimization problem leading to dag recovery. This can then lead to different types of problems, some of which are linear [park17, jaakkola2010learning, manzour2021integer], some quadratic [rytir2024exdag]. Furthermore, this method of cycle elimination is also typically augmented with a cutting plane method [Nemhauser91, rytir2024exdag].
Another method for acyclicity enforcement is derived from a well-known combinatorial optimization problem called linear ordering (LO) [gro85]. In the LO problem, we aim to find ”the best” permutations, which may be further constrained. In the case a directed acyclic graphs, these permutations correspond to the placements of edges and since the basis has only quadratic cardinality, the number of constraints is limited. The cycles are then excluded by imposing LO constraints. A perceived drawback of this approach is the neccessity for a quadratic cost function [seoh2020solving, gro85].
The third method for eliminating cycles involves enforcing constraints to ensure the nodes adhere to a topological order. A topological order is a linear arrangement of the nodes in a graph such that an arc exists only if node precedes node in this order. The discrete decision variables, indexed by the node and placement in the topological order determine the graph. It has been reported that in some cases this approach can lead to polynomial time learning [Shojaie10].
Recently, an alternative approach based on layered networks has been proposed [seoh2020solving]. The concept of layering forbids the placement of arcs between layers in a given direction. The problem of finding a layered graph is defined by the number of layers and the minimal number of layers for a given DAG is unique. This contrasts the topological order method described in the previous paragraph, which can have a possitive influence on the construction of the branch-and-bound tree [seoh2020solving].
One Shot Continuous Formulations
Recall that in one shot continuous variable adjacency matrix formulations, the variables denote both the structure (as far as their nonzeros) as well as the sign and magnitude of the weights themselves. Thus it is natural to consider that a constraint in the form of an equality of some function to zero could correspond to ensuring the right zero-nonzero structure of the adjacency matrix to establish acyclicity. On the other hand, considering that this must involve considerations of multiple transitions, potentially extensive matrix multiplication could, and we shall see is, involved.
The algorithm NOTEARS [zheng2018dags] and DYNOTEARS[pamfil2020dynotears] uses the following functional constraint in a continuous optimization algorithm to enforce the DAG structure of the graph,
(38) |
which is meant to approximate the following (perhaps more easily enforced) set of constraints,
(39) |
In [yu2019dag] they introduce a different constraint term that also enforces the DAG constraint, but appears to have better numerical stability, for small :
(40) |
In the procedure NO BEARS [lee2019scaling] the spectral radius is used to define the presence of a DAG constraint on the adjacency graph. Certain numerical approximations make this relatively feasible, despite the high complexity and nondifferentiability of the spectral radius of a matrix.
Finally, [yu2021dags] present DAGS with NOCURL, which obviates the need for an explicit functional constraint by solving:
with the space of skew-symmetric matrices and defines the gradient flow on the nodes of the graph.
5 Structure and Parameter Learning Algorithms
5.1 General Principles and Considerations
A fundamentally unique feature of learning DBNs corresponds to how structure and weights are treated, both in and of themselves and with respect to each other, as far as modeling and training. Theoretical foundations and best practices developed in the mature disciplines of the statistics of graphical models, random graph theory, time series, causal learning, and others, can provide a diverse source of insight for developing efficient and reliable methodologies.
Here we present a number of important points of consideration that can be observed from looking at the literature at successful attempts at representation as far as inference and learning. With the distinctions described below, we are able to properly identify and characterize existing structure-weight learners, as well as suggest extensions to fill in the natural empty places in any observed taxonomy.
Structure Learning
Structure Learning is the procedure of defining from data. This is a critical aspect to learning DBNs because this defines different independence structures between the random variables. Furthermore, these graphical conditional independence structures are interpretable as far as implying causal inference and discovery. It also precedes parameter learning - the space and dimensionality of the parameters in the model itself will vary as depending on the structure of the graph connections. Of course, the quality of the resulting fit on the parameter should inform the quality of the fit of the structure, insofar as it is instrumental.
Given both the rapidly exponentially exploding complexity of considering any encoding of structure, the resulting combinatorial optimization can become difficult to solve with large variable dimension. Structure learning provides a rich source of challenging problems for combinatorics, integer programming, and other discrete applied mathematics. However, at the same time, given the relative paucity of circumstances and means by which the curse of dimensionality can be mitigated, there is a degree to which structure learning serves as a significant limitation to the overall modeling procedure. This means that often, in more challenging settings, approximate suboptimal graph structure, or using alternative modeling techniques, are used.
Parameter Learning
Recall from the previous Section that there is often flexibility in the choice of the statistical model that corresponds to individual potential structures. This flexibility permits for incorporating off the shelf methods attuned for specific parametric forms.
There are some structure solvers that define and score a structure without defining parameters. These make use of binary or Gaussian models, as defined above, for which the computation of the marginal posterior is tractable. Specifically, the posterior of the graph structure given the data is computed through an integration that treats parameters as nuisance through an integration . In this case, a specific set of parameters is not explicitly defined, however, it can be said that parameters are computed implicitly. Indeed, the marginal likelihood of the structure is simply the integration, over the parameter space, of the posterior distribution for the parameters.
One can note this specific phenomenon regarding the interplay of learning structure and weights as unique to DBNs. Indeed it presents a clear tradeoff between computational ease and model faithfulness. One can also consider whether the structure of parameters are more important and significant as far as the overall modeling of the system of interest, and thus choose more or less complex models, and more or less stringent and exhaustive structure search, depending on this choice.
Frequentist and Bayesian
We shall use the frequentist versus Bayesian distinction to indicate a point estimate based on the optimization of a loss function or criterion, and a probabilistic model, implemented with sampling, that obtains a posterior distribution of the structure and weights given the data, respectively. A frequentist estimate is given as a complete specific structure encoding and a specific value for the parameters. It is generally expected, or at least sought, that the relationships that the graph identifies between various nodes representing the random variables is statistically significant. This presumption often becomes unrealistic in practice, and obtaining an appropriately scaled statistically significant entire network, that is, with all significant edges, is typically unavailable in real settings. However, since DBNs are generative rather than discriminative, this is often not a practical concern, as they are a component in an overall statistical modeling pipeline.
The alternative of Bayesian approaches allows for modeling the full distribution of uncertainty for the model considering the data. This makes the degree of confidence in the model quantitatively transparent. Thus, for any regime of data and parameters, some density could be sampled. However, the combinatorial burden of structure learning then becomes transferred to a slow mixing time. Moreover, inference will require numerical integration, and a set of samples is less interpretable to a lay user of the model. Thus, the choice between the two is generally instrumental, that is, in accordance with the ultimate modeling goal.
An effective and commonly used technique is to employ mixtures of a finite set of structures, see [friedman2000being]. This provides flexibility and the transparent uncertainty in the model, without having to mix through the entire combinatorial space defining possible structure.
Considerations Regarding the Relationship between Structure and Parameter Learning
It is clear that the two are not independent or orthogonal, but rather the hierarchical structure, and the discrete-continuous distinction, presents a number of possible choices as far as algorithmic options.
For instance, consider a particular point estimate of a structure and set of parameters. However, consider that the set of parameters is close to zero, and moreover, that is so close so as to include zero in a, e.g., 95% confidence interval. In this case, it is clear that this implies that the presence of this edge itself in the graph is suspect, that is, not implied by the data to statistical significance.
Criteria for structure still depend on the weights, even if it’s implicitly through integrating the marginal likelihood. Thus, if the weights have a poorly specified prior, or the parametric form for the model is incorrect, then this will curtail the legitimacy of the structure scoring process.
It would be expected that a structure with a low marginal likelihood should have greater uncertainty in the parameters.
These subtle but intuitive considerations suggest that modeling and learning with DBNs is often not an off-the-shelf straightforward use of a black box tool, but requires intuition as to the nature and mechanistic properties of the system of interest.
Hierarchical and One-Shot Methods
In general one can consider most learning methods to be hierarchical in the sense of first learning the structure, and with an amortized structure estimating or sampling the weights. The use of SEMs defined by adjacency matrices including both structure and weights simultaneously introduced what can be referred to as a one-shot approach (we remark the interestingly similar recent popularity of one-shot methods for neural architecture search that simultaneously perform parameter learning [guo2020single]).
In this case, a point estimate is obtained for both the structure and the weights simultaneously by solving an appropriate optimization problem that fits both of these as decision variables to the data. To this end there are two approaches we see in the literature. In [manzour2021integer] an IP (for BNs, readily adapted to DBNs) is presented that treats the structure as binary variables encoding the activation of edge links in the graph and the parameters as separate variables, and solves the challenging nonlinear mixed IP (relaxation into conic programs was considered in [kucukyavuz2023consistent]). Alternatively, the recent work DYNOTEARS [atanackovic2024dyngfn] presented a gradient based method for solving the structure-parameter learning as a purely continuous optimization problem for weight matrices in the graph. Enforcing sparsity is done to encourage accurate ground truth graph identification.
This presents a straightforward path to solving an optimization problem using existing toolboxes to obtain a fairly accurate point estimate of the structure and parameters. Methodologically, however, we observe that specifically, there is nothing to prevent encoding a binary variable indicating that an edge is present, and a parameter having a low magnitude to the point of zero being within the margin of error (or even being exactly zero in the IP case). These are clearly contradictory as far as the meaning of the edge.
We make one additional remark going back to hierarchical approaches. Note that one can consider that the frequentist-Bayesian distinction can be applied to present a taxonomy of methods. As a curious example, many Bayesian scoring methods, e.g. the IP method [BARTLETT2017258], can be considered hybrid frequentist-Bayesian. This is because implicitly the grading is done with a Bayesian parameter model, but a point estimate, that is one unique structure, is returned. Methodologically, we see that the advantages of a hierarchical is an offline calculation of scoring that permits the use of simple and powerful off the shelf commercial grade IP solvers, and the disadvantage is the conceptual contradiction of applying a frequentist mindset to learning structure with Bayesian models as weights. However, one can easily mitigate this in practice by sampling from multiple structures, as weighted in frequency by their respective marginal likelihoods. Regardless, theoretically, in the asymptotic regime, consistency can still be maintained with all approaches and variations thereof, however [koller2009probabilistic].
5.2 Methods for Learning Structure and Parameters in DBNs
Now we describe the details of several prominent algorithms that are used to train DBNs. These are not meant to be exhaustive, nor are they even intended to be chosen among the best performing in general. Rather, we hope to present a comprehensive variety, that is, we intend that each broad type of method that is commonly used and studied has a representative among the algorithms chosen. These algorithms use very different techniques, and treat all of the aforementioned considerations regarding learning, that is, the correspondence between structure and weights, and the distinction between points and samples and hierarchical and one shot methods. In addition, approximate (or “local”) versus exact (or “global”) methods will indicate the tradeoffs associated with seeking the best solution or seeking to find a satisficing statistical model.
5.2.1 Constraint Based
Under the assumptions of causal sufficiency (no hidden confounders) and faithfulness, classical algorithms developed by Spirtes et al. [causaldiscov_PC_FCI] have been proven to estimate the DAG without exhaustive enumeration of possible structures (which is impossible in interesting cases). The Peter-Clark (PC) algorithm is a method to retrieve the skeleton and directions of the edges, relying on an empirical hypothesis test of Conditional Independence (CI) for each pair of variables given a subset of other variables. It starts from a complete undirected graph and deletes sequentially edges based on these CI relations. PCMCI [pcmci] is adapted to time-series datasets and works for lagged links (causes precede effects). It operates two stages: 1) PC testing which identifies a potential set of parents with high probabilities for each variable . 2) using these parents as conditions for the momentary conditional independence (MCI) to address the false positives and test all variable pairs. Statistical tests ParCorr, GPDC, and CMI are used in both steps. PCMCI+ extends PCMCI to include contemporaneous links [runge2022discovering].
This is a good representative of a method that clearly prioritizes structure, and is a statistically principled frequentist technique for identifying said structure. As such there are strong asymptotic theoretical results for this method, and it is broadly accepted to be reliable as far as identifying the ground truth. As any method prioritizing structure, however, the necessity of focusing exclusively on a discrete procedure limits the scalability of this approach.
5.2.2 Score Based:
There are a number of methods that attempt to either optimize to obtain or sample from a high score of a Bayesian Criterion. We include a few of these methods due to their significant difference as far as the method of optimization/sampling.
Integer Programming
The Integer Programming based [BARTLETT2017258] uses the local score (BDeu, BGe, DiscreteLL, DiscreteBIC, DiscreteAIC, GaussianLL, GaussianBIC, GaussianAIC, GaussianL0) to optimize the network, amortizing its evaluation, thus obviating the need to compute parameters to compute the score. This algorithm was later released as GOBNILP [cussens2020gobnilp] (Globally Optimal Bayesian Network learning using Integer Linear Programming). GOBNILP finds the network with the highest score under the constraint that the underlying structure can be represented as a DAG. For every node in the graph and every possible parent set , binary variable is created. The optimization criterion is then sum over all possible vertices and all possible parent sets, where the BDeu score (we use BDeu score here as an example) for the selected parent set of every node is considered, i.e.,
(41) |
The constraints are then of two types. First, each vertex needs to have a single parent set, which for node formulates as
(42) |
The second constraint requires that there are no cycles in the graph. This is imposed by cluster constraints, which require that there must be node with no parents for any set of nodes. As there are exponentially many such sets of nodes, the optimization problem is solved, and if a cycle is in the final solution, the cluster constraint that prohibits the found cycle is added. Such computation is iterated until a DAG is found, which ensures that the optimal model is obtained.
This algorithm represents the curious “frequentist-Bayesian” approach to structure-parameter learning. As it is an IP based method, there are also practical limitations in regards to scaling, however, the method is broadly known to be reliable and, for its search space, efficient.
GFlowNets
GFlowNet (GFN) for structure learning [pmlr-v180-deleu22a] consists of approximating the posterior instead of finding a single DAG, to reduce uncertainty over models. They construct the sample DAG from the posterior as a sequential decision problem by starting from an empty graph and adding one edge at a time. The GFN environment is similar to previous approaches in Reinforcement Learning, where the states are different graphs, each associated with a reward, which is in this case the score of that structure. They define a terminal state to which every connected state is called complete. The possible actions are limited to edge adding (no edge reversal nor removal). In addition, they define a mask that prevents having cycles in the graphs. GFN’s goal is to model the whole distribution proportional to the rewards. It also borrows from Markov chain literature, using forward and backward transition probabilities, and , in the loss function that satisfies the detailed balance condition:
(43) |
where is the reward function of state . Extending GFN to DBN required changing the scoring functions BDe and BGe adequately and changing the static GFN’s mask to take into account the stationarity assumption (transitions are invariant in time) and present it as a block upper triangular matrix, to ensure that no edges are going from time slice to .
This has been recently extended in [deleu2024joint] for sampling the structure and weights simultaneously using recent developments of expanding the GFN environment to continuous variables [lahlou2023theory].
Monte Carlo Greedy Hill Search
Monte Carlo methods are classical for solving difficult statistical problems, and have been a popular choice for learning the structure and parameters of a DBN. There are two prominent Monte Carlo methods in the literature that developed the foundations and have been seminal in the development of structure learning algorithms. These include the work (1128 citations as of this writing) [friedman2000being] as well as (2344) [tsamardinos2006max], who developed the popular MMHC, a max-min hill climb (MMHC) procedure.
In the numerical experiments, we use DMMHC from the package dbnR, which uses a variation of dynamic max-min hill climbing [trabelsi2013new], proper for leaning DBNs.
MCMC
We use [kuipers2022efficient], a more recent development. It uses order based structure sampling and at the same time restricts the search space using conditional independence tests. This method, implemented in the BiDAG package, can be viewed in a way as a hybrid based method, combining both constraint and score based methodologies. Performance of the method is generally the strongest for smaller datasets.
5.2.3 One Shot Linear SEMs:
There are two prominent procedures that represent one shot learning of LSEMs. The two are based on integer and continuous based optimization. LSEMs indeed uniquely present the opportunity for continuous optimization methods, and as such present the possibility of scaling the estimation procedure, at the cost of theoretical guarantees of global convergence.
Integer Programming
The mixed integer-linear program defined in [manzour2021integer] is presented here:
(44) |
We can see that a linear model is fit with a standard least squares loss to the data. The constraints appear, in order, as enforcing that an absent structure, defined by the binary variable , corresponds to a zero weight, that is , and similarly for . Next, we enforce a DAG constraint on the integer variables. This was described above in the previous section. Finally, the binary and continuous variables are indicated.
Continuous Optimization
We begin by presenting the general algorithm introduced in [pamfil2020dynotears] which followed the well cited [zheng2018dags]. In this paper, they consider the transition dynamics of can be expressed using the SEM:
(45) |
which includes the transition encoding , whose sparsity pattern reflects the patterns of causation and magnitudes the linear regression coefficients in the transition. are autoregressive matrices in case of lagged effects. Here is the noise (note that in the original, this is denoted as , which we avoid for confusion).
They solve the optimization problem,
(46) |
wherein the nonlinear constraint function is based on the description in Section 4.3, in particular, see the motivation by (38).
This method is able to impressively identify the ground truth structure for many synthetic examples, while also performing well as far as predictive modeling and forecasting of real world datasets.
6 Numerical Results
The synthetic datasets were generated following causaLens [lawrence2021data] and the DBN data simulation code from the DBNclass package (available at https://github.com/cbg-ethz/DBNclass) from [psuter]. For causaLens, we set the maximum lag to 1 and the graph complexity to 30, representing complex causal graphs.
-
•
GFN: the prior network is learned using the original GFN algorithm from [pmlr-v180-deleu22a], and we learn the transition network using the modified version of the code with the BGe score for the DBN. The hyperparameters were kept as default which can be found on the GitHub repository https://github.com/tristandeleu/jax-dag-gflownet and we only change the number of iterations according to each experiment.
-
•
Dynotears: for small datasets we do a grid search for the hyperparameters over the following values: and and . For larger datasets (, , ) that require more time, we only use the algorithm with hyperparameters and equal to , and a small of .
-
•
GOBNILP: the algorithm only supports IID data. To use it, we run it twice on the data: on the first time slice to get the prior network, then on the two first slices to get the transition network.
-
•
MCMC: we use iterative MCMC followed by order MCMC from BiDAG package, to sample the MAP DAG. We start by a grid search for the small datasets where we choose the values and we set the on the size of parent sets as where is the number of covariates. For the large datasets, we restrict to and change according to the number of variables per experiment ( for and for ).
-
•
PCMCI+: we choose a range of for small datasets, and starting from and , we fix at 0.01. We choose ParCorr as the conditional independence test (which assumes univariate, continuous variables with linear dependencies and Gaussian noise). We further correct the p-values by False Discovery Rate control with an of .
-
•
HC-dbnR: we keep default parameters (see ttps://github.com/dkesada/dbnR).
% The parameters of the one shot frequentist ILP approach (see (LABEL:eq:iposmod)) were $b˙W = b˙A = 0.1$. The regularization parameters were $λ˙A^+ = λ˙A^- = λ˙W^+ = λ˙W^- = 0.05$.
Structure of Numerical Comparisons
We can consider two main purposes for which DBNs may be used, and so we perform tests comparing the learners for both criteria in an appropriate manner. In addition, we present results across the scale of small and medium covariate dimension problems. % In addition, we report on the time of execution, and present results across the scale of small and medium covariate dimension problems.
-
1.
Generative Accuracy A DBN is a generative model, meaning there are no labels, however, it is still meant to model the relationship between random variables. Thus a natural comparison as to the overall statistical quality of a model would be the classic train-test data split comparison of loss. That is, using a holdout validation set from the data, perform the learning to define a DBN model on the training data, and then perform a set of inference queries on this model, and compare their output to the ground truth output given by the validation set.
-
2.
Ground Truth Graph Identification One of the primary goals of using BN and DBN models for fitting various time-varying phenomena is causal discovery and causal inference. This amounts to being able to accurately reconstruct the graph from a noisy realization of the ground truth. Indeed under the causal identifiability assumption given above, the relative success by which a learner is able to compute this ground truth graph is, understandably so, a central for evaluating DBN learners in the literature. %
-
3.
Prediction and Forecasting Unique to DBNs, given that it is a time series based model, we are able to consider its accuracy as far as forecasting the future. This can be done by synthetically creating a ground truth DBN, then add one more time slice with the values of the variables estimated using the ground truth. This will be compared to the forward evolution, i.e., a forecast from the learned model.
Data Regimes
: Favorable Regime for Identification: This corresponds to $NT≫n$, in which case, the more generally well-developed methods are able to identify the ground truth graph. We shall take:
(47) |
High Dimensional Regime: In this case, causal identification will not be available because the number of trajectories and time steps is insufficient to specify the exact graph that generated the data. However, we can still attempt to train DBN models that fit the data appropriately.
(48) |
For each experiment in these data regimes, we generate 10 datasets and run the algorithms. We report the mean and standard deviation across our datasets in the following sections. For the algorithms where we performed the grid search, we keep the best results based on both SHD and AUROC equally. The chosen parameters for each experiment are listed in Table LABEL:table:params_dynotears and LABEL:table:params_pcmci. As for MCMC, the best performing parameter was $alpha = 0.01$ for all the experiments.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6.1 Model Validation Accuracy
%Test train split, perform some different inference tasks on the validation test set. %We evaluate the log-likelihood of the test set using dbnR package.
For accuracy’s validation, we split the time series so that the first $70 %$ are used for training, and the remaining $30 %$ are for testing. Then, we use the dbnR package to evaluate the log-likelihood of the test data given the predicted model. For Dynotears, only the structure was used to calculate the log-likelihood (so a binary adjacency matrix instead of the weighted one). Cycles were present in the Dynotears output networks so we used an algorithm that removed edges iteratively until cycles were no longer detected. Results are presented in Tables 6.1 and 6.1. For the error E in Table 6.1 for Gobnilp, a value -Inf was obtained for one of the datasets for that experiment ((3,5,10)). In the bnlearn package (from where dbnR imports the log-likelihood function), it is explained that logLik() returns -Inf if the data have probability or density equal to zero, which typically happens if the model is singular.
%See[pena2005learning]
%Favorable Data Regime
% % & (3,30,10) & (5,50,50) & (10,100,200) & (20,400,400) & (30,600,500) |
%\cmidrule(lr)2-6 %\cmidrule(lr)7-11 %\cmidrule(lr)12-18 |
GFN & -9.96$±$34.31 & -207.67$±$195.33 & -66740.91$±$22342.85 & -960522.9$±$46428.33 & -2542030$±$86678.95 |
Dynotears & -13.50$±$32.62 & -245.84$±$201.21 & -64746.42$±$21756.6 & -1056631$±$39963.83 & -3369917$±$43506.22 |
Gobnilp & -6.89$±$33.65 & -188.74$±$205.84 & -51572.06$±$17188.01 & -865201.8$±$9170.71 & OOM |
MCMC & -5.11$±$32.07 & -69.62$±$207.15 & -45776.51$±$15531.54 & -771035$±$786.78 & TL |
PCMCI+ & -10.78$±$32.52 & -144.57$±$215.43 & -67263.58$±$23255.77 & TL & TL |
HC-dbnR & -6.46$±$33.40 & -79.74$±$207.46 & -45782.72$±$15511.89 & TL & TL |
% One Shot F. ILP & |
%High Dimensional Regime
% & (3,5,10) & (5,10,20) & (10,20,40) & (20,40,50) & (30,60,100) |
%\cmidrule(lr)2-6 %\cmidrule(lr)7-11 %\cmidrule(lr)12-18 |
GFN & -36.89$±$9.98 & -341.29$±$17.37 & -2809.70$±$78.68 & -14166.43$±$247.86 & -61942.44$±$813.47 |
Dynotears & -32.07$±$7.94 & -329.96$±$17.44 & -2589.79$±$169.73 & -13860.83$±$233.30 & -66696.45$±$736.65 |
Gobnilp & E & -270.77$±$24.94 & -2151.40$±$76.75 & -10719.46$±$197.12 & OOM |
MCMC & -29.89$±$8.82 & -237.45$±$15.95 & -1773.13$±$34.47 & -8755.98$±$127.74 & TL |
PCMCI+ & -46.28$±$8.94 & -363.10$±$14.59 & -2898.88$±$80.93 & -14876.04$±$256.19 & TL |
HC-dbnR & -31.04$±$11.34 & -240.75$±$17.61 & -1819.80$±$38.34 & -8991.89$±$157.52 & TL |
% One Shot F. ILP & 29.60606 & 75.58703 & TL & TL & TL |
We see that overall it appears that PCMCI+ maintains the highest accuracy, however, for larger problem sizes becomes impractical, at which point Dynotears and GFN become the two serious options.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6.2 Structure Identification
%Reconstruction distance to the correct graph %( Structural Hamming Distance)
To evaluate the qualitative measures of the predicted structure, we compared the predictions with the ground truth adjacency matrix. The comparison was made using the Structural Hamming distance (SHD), which is informally the number of edges that need to be either removed from or added to the predicted structural graph to convert it to the ground truth graph. The second measure is the AUROC, a standard metric that measures the area under the receiver operator characteristic. For GFN, we used a 99th percentile threshold on the posterior for each experiment to only retain the highest probabilities. The results can be found in Tables 6.2 and LABEL:table:hd_roc_shd. In PCMCI+ experiments for the high dimensional regime in Table LABEL:table:hd_roc_shd, the algorithm returns an empty matrix, which explains the 0.5 AUROC in all the experiments.
%Favorable Data Regime
%