NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Learning Bounded Tree-width Bayesian Networks using Integer Linear Programming

Pekka Parviainen, Hossein Shahrabi Farahani, Jens Lagergren

Abstract

Learning the structure of a Bayesian Network (BN) from data is a fundamental task in machine learning, typically aimed at maximizing a scoring function like BIC. However, the resulting models often have high tree-width, making probabilistic inference computationally prohibitive. This paper introduces a novel approach to learn BN structures subject to a strict upper bound on tree-width. By formulating the problem as an Integer Linear Program (ILP) and utilizing a branch-and-cut algorithm, the proposed method provides an "anytime" solver that finds provably optimal or near-optimal bounded tree-width networks for datasets with dozens of variables.

Introduction

Bayesian Networks are essential for representing complex joint probability distributions. However, they face a dual challenge: structure learning is NP-hard, and subsequent inference is also NP-hard in general. The complexity of inference is exponentially tied to the tree-width of the network—a measure of its "tree-likeness." While most structure-learning algorithms focus solely on maximizing data fit (score), they often produce high tree-width models that are unusable for practical querying. This research addresses the problem of finding the highest-scoring BN structure under a fixed tree-width constraint $k$, ensuring that future inference remains tractable (linear in the number of nodes).

Methodology

The authors propose an ILP-based framework called TWILP. The objective is to maximize a decomposable score (e.g., BIC or BDeu) subject to two primary sets of constraints:

  1. Acyclicity Constraints: To ensure the resulting graph is a Directed Acyclic Graph (DAG), the authors employ "cluster constraints," which are standard in ILP-based BN learning.
  2. Tree-width Bounding Constraints: This is the core innovation. The authors introduce an auxiliary "y-graph" that encodes a k-tree—a maximal graph with tree-width $k$. By requiring the moralized version of the BN to be a subgraph of this k-tree, they guarantee the BN's tree-width is at most $k$. To make this linear, they utilize a "root graph" construction, which defines k-tree properties through linear inequalities.

The problem is solved using CPLEX 12 via a branch-and-cut approach. Since the number of constraints is exponential, they are added dynamically only when violated. Custom feasibility heuristics are also employed to provide the solver with high-quality initial solutions, improving convergence.

Experimental Results

The TWILP algorithm was evaluated on a variety of benchmark datasets ranging from small (Asia, 8 nodes) to large (Carpo, 60 nodes), with sample sizes varying from 100 to 10,000.

Experimental results comparing scores and optimality gaps for tree-width bounds k=2, k=3, and unbounded structures across various datasets.

As shown in the table above, the algorithm achieves several key milestones:

  • Optimality: For many datasets, including Alarm and Adult, the algorithm found provably optimal solutions (indicated by "OPT" or a 0.00 gap) within the 12-hour time limit.
  • Score Trade-offs: Enforcing a low tree-width (e.g., $k=3$) often results in a negligible loss in score compared to unbounded networks. For the Alarm dataset with 10,000 samples, the $k=3$ score is nearly identical to the unbounded score, demonstrating that real-world dependencies can often be captured by low tree-width structures.
  • Scalability: The ILP formulation successfully handled the Carpo dataset (60 variables), outperforming previous exact methods based on dynamic programming.

Discussion and Conclusion

The TWILP approach demonstrates that learning bounded tree-width BNs is practical for medium-to-large datasets. The "anytime" nature of the ILP solver allows users to obtain high-quality models even if the search is terminated early, with a clear measure of the optimality gap.

However, challenges remain. While the solver finds good solutions quickly, proving optimality for very large or complex datasets like Carpo can be time-consuming. Future work may focus on more sophisticated cutting planes or decomposition methods to scale to hundreds of variables. Additionally, investigating why many real-world distributions are well-represented by low tree-width structures could lead to better heuristics for choosing the bound $k$.

Summary updated

BibTeX
@inproceedings{parviainen2014learning,
  author = {Pekka Parviainen and Hossein Shahrabi Farahani and Jens Lagergren},
  title = {{Learning Bounded Tree-width Bayesian Networks using Integer Linear Programming}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2014},
}
Figure