BayesDB: A probabilistic programming system for querying the probable implications of data

Vikash Mansinghka, Richard Tibbetts, Jay Baxter, Patrick Shafto, Baxter EavesarXiv 2015

BayesDB is a system designed to make rigorous statistical inference as accessible as standard database queries. While traditional SQL databases are excellent at telling you what is in your data, BayesDB aims to tell you what your data implies.

The Gap Between Storage and Understanding

In the modern data landscape, there is a massive gap between data storage and data understanding. Engineers and researchers can easily query a database for a specific record, but asking "Is this data point an outlier?" or "What is the likely value of this missing cell?" requires deep expertise in statistics and machine learning. Traditional tools require users to manually select models, handle messy data, and account for uncertainty—tasks that are prone to error and bias. BayesDB addresses this by providing a "model-independent" abstraction layer, where the system handles the heavy lifting of model discovery and inference.

Technical Pillars

The system is built on four core pillars:

  1. BQL (Bayesian Query Language): An extension of SQL that introduces three core primitives: SIMULATE (to generate synthetic data), INFER (to predict missing values), and ESTIMATE (to calculate probabilities and dependencies).
  2. MML (Meta-modeling Language): A language for experts to guide the automated model-builder. It allows for "qualitative probabilistic programming," where a user can assert that "Variable A depends on Variable B" without writing a specific mathematical equation.
  3. Automated Model Discovery: By default, BayesDB uses a semi-parametric Bayesian approach based on CrossCat. It automatically partitions variables into independent groups and clusters rows within those groups to find hidden structures.
  4. Hybrid Modeling: BayesDB allows users to "plug in" custom algorithmic or physical models (like Kepler’s laws for orbital mechanics) to complement automated statistical baselines.

Key Insights: Information Theory over Correlation

BayesDB uses mutual information to detect dependencies. Unlike standard correlation, which only finds linear relationships, BQL can identify complex, non-linear, and even "context-specific" relationships. For example, it can determine the probability that one variable depends on another across the entire dataset.

Figure 3: BayesDB can estimate the probability of dependence between columns using information-theoretic measures.

Instead of picking one "best" model, BayesDB maintains an ensemble of models. When a query is executed, it averages the answers across all plausible models, which naturally accounts for uncertainty. The underlying CrossCat engine breaks the table into smaller, independent sub-problems, making it robust to the "curse of dimensionality" in high-dimensional data.

Real-World Applications and Results

The paper demonstrates BayesDB’s versatility across several distinct datasets:

  • UCS Satellite Database: A collection of ~1,000 Earth satellites. BayesDB successfully flagged unit conversion errors and decimal placement errors as high-probability anomalies. It could also generate plausible "synthetic" satellites, correctly predicting likely countries of origin and purposes based on historical patterns.
  • Gapminder: A sparse dataset of macroeconomic indicators spanning 400 countries and 500 years. Despite 97% of the data being missing, BayesDB extracted meaningful temporal dependencies and country similarities.
  • Salary Survey: An anonymous survey used to show how qualitative domain knowledge (like the impact of geography on pay) can improve model accuracy.
Figure 1: Frequency analysis of satellite purposes and operator countries within the UCS Satellite Database.

Limitations and Future Work

While powerful, BayesDB has several areas for growth. The current system identifies predictive relationships but does not yet have native support for causal counterfactuals. It also assumes data is "missing at random," which may not hold true for all datasets. Furthermore, while suitable for tables with tens of thousands of rows, further optimization is needed for "Big Data" scales and native support for longitudinal or time-series data.

Summary updated

BibTeX
@misc{mansinghka2015bayesdb,
  author = {Vikash Mansinghka and Richard Tibbetts and Jay Baxter and Patrick Shafto and Baxter Eaves},
  title = {{BayesDB: A probabilistic programming system for querying the probable implications of data}},
  year = {2015},
  eprint = {1512.05006},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1512.05006},
}
Figure