Neural Bayesian Network Understudy

Paloma Rabaey, Cedric De Boom, Thomas Demeester

TL;DR

This paper introduces a neural framework designed to act as an "understudy" to a Bayesian Network (BN), capable of answering arbitrary probabilistic queries via dynamic input-output masking. By incorporating known causal structures (Directed Acyclic Graphs, or DAGs) directly into the neural training process via regularization or input corruption, the neural model approximates exact conditional probabilities and matches or exceeds BN sample efficiency in low-data regimes.

What Problem Does This Paper Address?

In high-stakes domains like healthcare, Bayesian Networks are attractive because they reason under uncertainty, handle diagnostic and prognostic queries, and incorporate prior causal expert knowledge. However, BNs struggle with continuous data and cannot directly ingest unstructured data (such as clinical notes or medical imaging). Conversely, deep neural networks handle unstructured data natively but are uninterpretable "black boxes" that struggle to respect known causal dependencies.

The authors propose a foundational first step toward bridging this divide: training a neural network that acts as a functional replica (an understudy) of a BN on discrete variables, while incorporating causal constraints from a known DAG.

Methods

The architecture enables arbitrary conditioning queries $P(T \mid E = e)$ by treating any subset of variables as evidence $E$ and the remainder as targets $T = V \setminus E$.

Discrete Sample ──> [Evidence Mask] ──> [Feed-Forward NN] ──> [Target Softmax] ──> Predicted Distributions
                           │                                          │
                  Replace unobserved with                    Evaluate Cross-Entropy
                     learnable vector v₀                        only on Targets
  1. Dynamic Masking Architecture: All $N$ variables are represented as concatenated one-hot vectors ($k = \sum n_i$). Target variables are masked at the input and replaced with a static, learnable default vector $v_0$. The model predicts normalized distributions over all variables; outputs for evidence variables are replaced by their observed one-hot inputs, and cross-entropy loss is computed exclusively over the targets.
  2. Injecting Causal Independence Relations ($X \perp Y \mid A$): The authors extract d-separation rules from the causal DAG and enforce them through two alternative methods:
  3. Regularization (REG): Adds an explicit loss penalty $\mathcal{L}^{\text{REG}}_{X \perp Y \mid A}$ measuring the squared difference in predicted target probabilities $P(X \mid A = a, Y = y)$ versus $P(X \mid A = a, Y = y')$. If $X$ is independent of $Y$ given $A$, changing $Y$ should not shift predictions for $X$.
  4. Evidence Corruption (COR): When training a sample where evidence $E$ contains $\{Y\} \cup A$ and the target is $X$, the model randomly re-samples (corrupts) the value of $Y$. This trains the network to ignore $Y$ when predicting $X$ in the presence of $A$.

Datasets

The proof-of-concept is evaluated on synthetic data generated from the standard "Asia" (Chest Clinic) Bayesian Network (Lauritzen & Spiegelhalter, 1988):

  • Graph: 7 binary variables (e.g., smoking, lung cancer, tuberculosis, X-ray result, dyspnea) with 20 independent parameters.
  • Independence Relations: 191 unique conditional independence statements extracted via d-separation.
  • Evaluation Splits:
  • Total MAE: Evaluated over all 2,059 possible evidence assignments (weights rare and common scenarios equally).
  • Sample MAE: Evaluated over 1,000 queries sampled from the joint distribution (weights common evidence combinations more heavily).

Key Insights and Ideas

  • Arbitrary Queries with Fixed Parameters: Traditional supervised nets predict a fixed target $Y$ given fixed inputs $X$. By using masked one-hot vectors and training across randomized evidence-target splits, a single small feed-forward network can answer any arbitrary conditional query.
  • Neural Networks Excel at Rare Combinations: Classical BNs trained with maximum likelihood estimation (even with K2 smoothing) struggle with evidence combinations rarely or never seen in small training sets. The neural understudy interpolates well across the feature space, outperforming the BN baseline on total MAE when training samples are scarce ($N \le 100$).
  • Symmetry Between REG and COR: Both regularization and input corruption successfully force the network to respect d-separation properties. REG marginally outperforms COR because it systematically iterates through all valid independence triples, whereas COR only applies when randomized sample masking happens to match a specific independence condition.

Key Results

  • Sample Efficiency (RQ1 & RQ2): At 100 training samples, the causal neural models (NN+REG with $\alpha = 10$ and NN+COR) achieve lower Total Mean Absolute Error ($\approx 0.11$) than both the basic neural network ($\approx 0.14$) and the exact BN baseline ($\approx 0.14$).
  • Large Sample Convergence: As the training set grows to $10^4$ samples, the BN baseline achieves the lowest total MAE ($\approx 0.03$), slightly outperforming the neural variants ($\approx 0.04$).
  • Robustness to Mis-specified Causal Graphs (RQ3):
  • Edge Removal (Spurious Independence): If a true causal edge is missing from the prior DAG, both the BN and the neural models degrade substantially, showing elevated variance and error.
  • Edge Addition (Conservative Dependency): Adding an extra edge introduces no false independence assumptions; models remain stable and perform almost identically to the ground-truth baseline.

Limitations and Future Work

  • Small-Scale Toy Domain: The experiments are restricted to a 7-node discrete toy network ("Asia"); scalability to graphs with hundreds of nodes and high-cardinality discrete variables remains unproven.
  • No Unstructured Data Yet: Although handling unstructured data (e.g., text, images) is the motivating thesis of this research direction, this initial paper evaluates only discrete observational tabular data.
  • Approximate Inference: The neural network outputs approximations of conditional probabilities rather than mathematically guaranteed joint distribution margins.
  • Future Directions: The authors plan to integrate continuous variables, connect pretrained language models/encoders to the masked inputs, and scale the framework to realistic clinical decision support settings.

Summary updated

BibTeX
@inproceedings{rabaey2022neural,
  author = {Paloma Rabaey and Cedric De Boom and Thomas Demeester},
  title = {{Neural Bayesian Network Understudy}},
  booktitle = {CML4Impact @ NeurIPS},
  year = {2022},
  url = {https://openreview.net/forum?id=po2H3MGgOp-},
}
Figure