Abstract
FACTORBASE is a novel framework designed to bring multi-relational machine learning directly into the database layer. By leveraging standard SQL to manage metadata and compute sufficient statistics, FACTORBASE enables the discovery of complex graphical models, such as Bayesian networks, across multiple relational tables. This approach addresses the scalability bottlenecks of traditional Statistical Relational Learning (SRL) systems, which often require data flattening or external tool integration. Our evaluation across six real-world benchmarks demonstrates that FACTORBASE scales to datasets with millions of records, providing significant speedups in both model learning and prediction.
Introduction
Most machine learning algorithms require data to be presented in a single, "flat" table. However, real-world data is typically relational, spread across multiple tables to minimize redundancy and maintain structural integrity. Flattening such data for standard ML tools often leads to massive data duplication and the loss of critical relational dependencies. Statistical Relational Learning (SRL) aims to model these dependencies directly, but existing SRL systems struggle with scalability and the overhead of data movement. FACTORBASE proposes a "BayesStore" approach, where the statistical model is managed entirely within a Relational Database Management System (RDBMS).
Methodology
FACTORBASE utilizes three internal databases to manage the learning process:
- Random Variable Database (VDB): Stores metadata about entities, relationships, and attributes.
- Count Database (CDB): Stores contingency tables containing sufficient statistics—raw counts of variable combinations.
- Models Database (MDB): Stores the learned model structure and parameters.
The core innovation lies in SQL Metaqueries, which automatically generate the necessary SQL to count occurrences across complex relational schemas. Furthermore, the system introduces "block access" for inference, using SQL's set-processing power to calculate probabilities for thousands of instances in a single pass.
Key Insights
The framework demonstrates that SQL is naturally suited for the join-and-aggregate operations required to compute sufficient statistics. By treating model management as a data management problem, FACTORBASE leverages RDBMS query optimizers to achieve high performance. The use of NATURAL JOIN for batch prediction results in a 10 to 100-fold speedup compared to traditional instance-by-instance looping. This in-database processing allows the system to handle datasets an order of magnitude larger than what previous SRL systems could process.
Results and Evaluation
The system was tested on six real-world benchmarks, including IMDb (1.3 million tuples), Movielens, and Mutagenesis.
- Scalability: FACTORBASE successfully learned models on datasets with over $10^6$ records, whereas prior state-of-the-art systems were typically limited to $10^5$.
- Efficiency: For the IMDb dataset, it managed over 15 million sufficient statistics and completed parameter learning in approximately 8 minutes.
- Performance: In comparative tests, FACTORBASE significantly outperformed functional gradient boosting methods (like RDN-Boost) on large-scale data, often succeeding where other methods failed to terminate.
Conclusion
FACTORBASE proves the viability of in-database relational learning by moving the model to the data rather than the data to the model. Future research will explore deeper integration with query optimizers, support for latent variables, and extension to distributed SQL environments like SparkSQL.
Summary updated