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

Join Bayes Nets: A new type of Bayes net for relational data

Oliver Schulte, Hassan Khosravi, Flavia Moser, Martin Ester

Abstract

Many databases store data in relational format, with different types of entities and information about links between the entities. The field of statistical-relational learning (SRL) has developed a number of new statistical models for such data. In this paper we focus on learning class-level or first-order dependencies, which model the general database statistics over attributes of linked objects and links (e.g., the percentage of A grades given in computer science classes). Class-level statistical relationships are important in themselves, and they support applications like policy making, strategic planning, and query optimization. Most current SRL methods find class-level dependencies, but their main task is to support instance-level predictions about the attributes or links of specific entities. We focus only on class-level prediction, and describe algorithms for learning class-level models that are orders of magnitude faster for this task. Our algorithms learn Bayes nets with relational structure, leveraging the efficiency of single-table nonrelational Bayes net learners. An evaluation of our methods on three data sets shows that they are computationally feasible for realistic table sizes, and that the learned structures represent the statistical information in the databases well. After learning compiles the database statistics into a Bayes net, querying these statistics via Bayes net inference is faster than with SQL queries, and does not depend on the size of the database.

Introduction

Real-world data is rarely "flat." Instead, it is typically stored in relational databases where multiple tables are linked through foreign keys. For example, a university database might contain separate tables for Students, Courses, and Professors, with a "Registration" table capturing the relationships between them. Traditional machine learning algorithms often require flattening this data into a single table, which can lead to significant information loss or massive redundancy.

Statistical-Relational Learning (SRL) has emerged to address this by modeling dependencies directly within relational structures. However, most existing SRL methods are optimized for instance-level prediction—calculating the probability of a specific outcome for a specific individual (e.g., "Will Jack get an A in CS101?"). This paper argues that for many high-level tasks, such as strategic planning or query optimization, we primarily need class-level dependencies (e.g., "What is the general relationship between student intelligence and grades?"). By focusing exclusively on these general statistics, the authors introduce a framework that is significantly more efficient than previous approaches.

Join Bayes Nets (JBNs)

The core contribution is the Join Bayes Net (JBN). In a JBN, nodes represent attributes from various tables across the database schema. Unlike standard Bayes nets, JBNs also incorporate Boolean "link" variables that indicate whether a relationship exists between entities. This allows the model to capture how the presence or absence of a link correlates with entity attributes.

A Join Bayes Net structure representing dependencies across multiple relational tables.

The Learn-and-Join Algorithm

To learn these structures efficiently, the authors propose the Learn-and-Join algorithm. This approach avoids the computational explosion of considering all possible relationships simultaneously by decomposing the problem into phases.

  1. Phase 1: The algorithm learns independent Bayes nets for each entity table (e.g., Student, Professor).
  2. Phase 2: It joins relationship tables with their corresponding entity tables. New dependencies are learned while keeping the previously discovered intra-table edges fixed.
  3. Phase 3: Longer-range dependencies are found by joining pairs of relationship tables, allowing the model to capture chains of influence across the database.
The three-phase Learn-and-Join algorithm for building relational Bayes nets.

A critical component of this process is the Virtual Join (VJ) algorithm. VJ addresses the "negation problem"—the difficulty of counting instances where a relationship does not exist. By using a recursive "1-minus" probability trick, VJ allows the system to calculate these frequencies without performing expensive, massive table joins.

Experimental Results

The JBN framework was evaluated on three datasets: a synthetic University database, the MovieLens movie rating dataset, and a complex Financial database.

The results demonstrate significant performance gains:

  • Speed: On the Financial dataset, the JBN approach was 600 times faster than state-of-the-art Markov Logic Networks (MLNs). While MLNs often timed out on medium-sized data, JBNs completed learning in under 10 minutes.
  • Accuracy: The models accurately represented database statistics, with average probability errors under 3% for MovieLens and under 8% for the Financial data.
  • Inference Efficiency: Once learned, the JBN acts as a "compiled" version of the database statistics. Querying the JBN is often faster than running SQL COUNT queries, and the inference time remains constant regardless of the underlying database size.

Conclusion and Future Work

Join Bayes Nets provide a powerful tool for extracting class-level insights from relational data at scale. By decoupling class-level statistics from instance-level prediction, the authors achieve massive speedups without sacrificing accuracy. Future research aims to extend the "Learn-and-Join" algorithm to handle dependencies between different types of relationships and to automate the handling of self-referential relationships, such as friendships within a single student table.

Summary updated

BibTeX
@misc{schulte2008join,
  author = {Oliver Schulte and Hassan Khosravi and Flavia Moser and Martin Ester},
  title = {{Join Bayes Nets: A new type of Bayes net for relational data}},
  year = {2008},
  eprint = {0811.4458},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/0811.4458},
}
Figure