We illustrate how to learn a Bayesian network from a database with an example. We have a database D which is given in Tab 3.1. We have four objects with three features , and the features can take the values T for true or F for false .
First, we generate a hypothesis space of all possible structures of the network. Some of the possible structures are shown in Fig 3.6.
Then we calculate the likelihood of each model given the database, the sample likelihood:
Where Sm is a structure, the parameters for the structure. Then, if we look at structure d from Fig 3.6, we get:
which with computed from the whole database:
Then:
These values are computed for all i and for all models, and then compared to find the best fitting model. Doing it this way involves vast computation, and finding a Bayesian network structure is indeed NP-complete. This situation was pretty simple, since we had only three features, and none of them had missing values.