Bayesian Structure Learning and Sampling of Bayesian Networks with the R Package BiDAG

Polina Suter, Jack Kuipers, Giusi Moffa, Niko Beerenwinkel · DOI

Introduction

Learning the structure of a Bayesian Network (BN)—represented as a Directed Acyclic Graph (DAG)—is a fundamental challenge in computational statistics and machine learning. Because the number of possible DAGs grows super-exponentially with the number of variables, identifying the optimal structure is NP-hard. While traditional "search-and-score" or constraint-based methods often return a single point estimate, Bayesian methods like Markov chain Monte Carlo (MCMC) allow for sampling from the posterior distribution. This provides a crucial measure of uncertainty, especially in data-sparse regimes. However, traditional MCMC methods have historically been limited to small networks (typically under 20 nodes). The R package BiDAG addresses this limitation, offering a high-performance framework that scales Bayesian structure learning to graphs with hundreds of nodes.

Methodology: The BiDAG Framework

BiDAG implements several advanced MCMC schemes designed to navigate the complex space of DAGs efficiently.

1. Order MCMC

Rather than searching the discrete and often "peaky" space of DAGs directly, BiDAG utilizes Order MCMC. This approach searches the space of node orderings. The landscape of orderings is significantly smoother than that of DAGs, which facilitates faster convergence of the Markov chain.

2. Partition MCMC

As an unbiased alternative to Order MCMC, the package includes Partition MCMC. This method operates on ordered partitions of nodes, ensuring that every possible DAG has an equal prior probability, thereby avoiding the biases sometimes introduced by order-based priors.

3. The Iterative Hybrid Approach

The core innovation of BiDAG is its iterative hybrid approach. The process begins by using a computationally efficient algorithm (such as the PC algorithm) to define an initial "core" search space—a skeleton of likely edges. BiDAG then runs MCMC within this restricted space. Crucially, it iteratively expands the search space by adding edges that appear frequently in high-scoring graphs during the MCMC phase. This allows the algorithm to "correct" errors or omissions made during the initial pruning phase, combining the speed of constraint-based methods with the robustness of Bayesian sampling.

The package supports both discrete data (via the BDe score) and continuous data (via the BGe score), and extends to Dynamic Bayesian Networks (DBNs) for time-series analysis.

Empirical Evaluation

The authors validated BiDAG using both synthetic and real-world datasets:

  • Simulated Data: A synthetic dataset (gsim100) featuring 100 nodes and 100 observations, and a DBN dataset with 15 variables.
  • Real-World Application: Mutation data from The Cancer Genome Atlas (TCGA), specifically focusing on kidney cancer cohorts (KIRP and KIRC) to identify distinct mutational pathways and driver gene interactions.

Key Results and Insights

The iterative expansion scheme proves critical for accuracy. In the 100-node simulation, a standard search on a statically pruned space yielded a True Positive Rate (TPR) of only 0.58. By applying seven iterations of BiDAG’s expansion scheme, the TPR reached nearly 1.0, and the log-score improved from -17952 to -15195.

Furthermore, the package demonstrates that the Maximum A Posteriori (MAP) graph—the single highest-scoring graph—can be prone to false positives when data is limited. By performing model averaging over sampled graphs, BiDAG produces a "consensus" graph that offers a more reliable representation of the underlying structure.

In biological applications, BiDAG successfully identified known driver genes (e.g., TP53, VHL) and revealed subtype-specific network structures, highlighting its potential for high-dimensional genomic research.

Limitations and Future Directions

Despite its advancements, BiDAG faces challenges in extremely dense networks, as the computation of score tables is exponential relative to the maximum number of parents allowed per node ($K$). While $K=14$ is currently feasible, further optimization is needed for highly connected graphs. Additionally, while Order MCMC is highly efficient, the unbiased Partition MCMC converges more slowly, presenting a trade-off between speed and prior neutrality. Future work may involve integrating alternative initial search space algorithms and developing new MCMC moves to enhance the convergence of partition-based sampling.

Summary updated

BibTeX
@article{suter2023bayesian,
  author = {Polina Suter and Jack Kuipers and Giusi Moffa and Niko Beerenwinkel},
  title = {{Bayesian Structure Learning and Sampling of Bayesian Networks with the R Package BiDAG}},
  journal = {J. Stat. Softw.},
  year = {2023},
  doi = {10.18637/jss.v105.i09},
}
Figure