Skip to Content

Calculating Fit: DL(D|B)

Each observation contributes the negative base-2 logarithm of the probability assigned to it by the Bayesian network. The description length of the dataset is the sum of these contributions, measured in bits.

DL(D∣B)=∑j=1NDL(ej∣B)=∑j=1Nlog⁡21PB(ej)=−∑j=1Nlog⁡2PB(ej).\begin{aligned} \mathrm{DL}(D\mid B) &= \sum_{j=1}^N \mathrm{DL}(e_j\mid B) \\ &= \sum_{j=1}^N \log_2\frac{1}{P_B(e_j)} \\ &= -\sum_{j=1}^N \log_2 P_B(e_j). \end{aligned}

Here, DD is the dataset, NN is the number of rows, eje_j is the nn-dimensional observation in row jj, and PB(ej)P_B(e_j) is its joint probability under network BB.

Loading SVG...

The fitted one-arc model assigns each outcome its observed frequency. Outcomes 00 and 11 each occur seven times. Outcomes 01 and 10 each occur once and cost 4 bits apiece. Multiplying each unrounded cost by its count and summing gives 24.70 bits.

The chain rule expresses the joint probability as a product across nodes.

DL(D∣B)=−∑j=1Nlog⁡2(∏i=1nPB(xij∣πij))=−∑j=1N∑i=1nlog⁡2PB(xij∣πij).\begin{aligned} \mathrm{DL}(D\mid B) &= -\sum_{j=1}^N \log_2\left(\prod_{i=1}^n P_B(x_{ij}\mid\pi_{ij})\right) \\ &= -\sum_{j=1}^N \sum_{i=1}^n \log_2 P_B(x_{ij}\mid\pi_{ij}). \end{aligned}

Here, xijx_{ij} is the value of node ii in row jj, and πij\pi_{ij} is the configuration of that node’s parents in the same row.