Introduction
PPDL (Probabilistic Programming with Datalog) is a declarative framework that integrates probabilistic programming directly into relational databases. By extending Datalog with stochastic functions and integrity constraints, it enables the specification of complex statistical models as probability distributions over possible database outcomes.
Bridging the Gap: Databases and Probabilistic Models
Modern machine learning frequently utilizes probabilistic programming (PP) to define complex models. However, a significant disconnect exists between these models and the relational databases where data is stored. Traditional approaches often treat databases as simple storage, requiring data export to external PP environments. Conversely, existing probabilistic databases often lack the declarative power to express complex dependencies or treat observations as first-class citizens. PPDL addresses this by providing a language that is both database-native and statistically expressive.
Methods and Formalism
PPDL extends standard Datalog in two key ways:
- Stochastic Rule Heads: Rules can have conclusions drawn from probability distributions. For instance, a rule might specify that an earthquake occurs in a city with a probability sampled from a Bernoulli (
Flip) distribution. - Integrity Constraints for Observations: PPDL uses standard database integrity constraints to represent Bayesian observations. If a "possible world" violates a constraint, it is eliminated, and the remaining probabilities are normalized, effectively performing Bayesian conditioning.
To define semantics, PPDL is translated into Datalog$^{\exists}$ (Datalog with existential quantifiers). A modified "chase procedure" generates "possible worlds"—minimal database instances satisfying the rules. The probability of each world is the product of the weights of all random choices made during its generation.
Case Study: The Burglar Model
The framework is demonstrated using a refined version of Judea Pearl’s "Burglar" example. A database containing information about houses, businesses, and cities is combined with PPDL rules to estimate the likelihood of burglaries or earthquakes given observed alarms.
Key Insights
- Observations as Constraints: Unifying Bayesian observations with database integrity constraints allows programmers to force the model to consider only worlds where predicted outcomes match recorded data (e.g.,
Alarm(x) ↔ ObservedAlarm(x)). - Distributional Relations: The translation to Datalog$^{\exists}$ introduces "distributional relations" that capture the parameters and outcomes of random draws, making the probabilistic process transparent.
- Robust Declarative Semantics: PPDL is semantically independent of algorithmic evaluation, unlike many PP languages where results may depend on execution order.
Results and Future Directions
The paper establishes a formal mapping from PPDL to Datalog$^{\exists}$, proving that the chase procedure defines a proper probability space. While PPDL currently supports discrete distributions, future work aims to incorporate continuous distributions and improve inference tractability through sampling techniques like MCMC.
Summary updated