0
$\begingroup$

I have been going through some tutorials regarding Bayesian Networks, but i have yet to see them applied to tabular data, i.e. a dataset. I have created this dummy example to experiment, and attempt to apply them to tabular data. Let's say that we have the following dataset.

enter image description here

where the connections between the random variables are:

enter image description here

and in this example let's assume that we want P(T=1|A,HR,E,S,C,BP). By doing some basic algebra:

enter image description here

However, from the above table we know that there were 6 out of 9 occurrences of T = 1, which would have yielded a probability of 6/9 ~ 0.67. So now I am wondering if I am doing something wrong, or if I am missing something.

$\endgroup$
5
  • 1
    $\begingroup$ $P(T=1|A,HR,E,S,C,BP)$ is a function of $A,HR,E,S,C,BP$. What is the number you are calculating supposed to represent and why do you expect it to be equal to the observed frequency of $T=1$ ? $\endgroup$
    – J. Delaney
    Commented May 11, 2022 at 16:54
  • $\begingroup$ These are some dummy data that do not represent anything. The reason why i expect P(T = 1) to equal the observed frequency, is that all events that T (and hence T=1) depends upon are occurring. This the main query that i have with this post. Also, what would the conditional probability need to look like for P(T = 1) ~ 0.67? $\endgroup$
    – Olive Yew
    Commented May 11, 2022 at 17:26
  • $\begingroup$ $P(T=1)$ is not a conditional probability so I fail to understand how is it related to any of your calculations $\endgroup$
    – J. Delaney
    Commented May 11, 2022 at 17:37
  • $\begingroup$ Sorry what is meant is, what would i need to condition upon for the probability of T=1 in this network to be 0.67? $\endgroup$
    – Olive Yew
    Commented May 11, 2022 at 17:40
  • $\begingroup$ 0.67 is the observed marginal probability of $T=1$. You don't need to condition on anything. $\endgroup$
    – J. Delaney
    Commented May 11, 2022 at 18:06

1 Answer 1

1
+50
$\begingroup$

The application of Bayesian Networks to tabular data is called learning in Bayesian networks. There are many sources for that.

The topic is interesting and maybe complex, but in general one defines parameters (unknown probabilities in the conditional probability tables and unknown parameters of distributions - for example mean and variance of a gaussian) and add them to the BN. Thus the conditional probability table that uses that unknown probability will also depend on that parameter, as will the gaussian with unknown mean. This parameters are top nodes in the BN (no parents), and thus one has to specify their priors. If the parameter is a unknown probability, the prior is usually a beta distribution; if the parameter is a set of related probabilities, the prior is a Dirichlet distribution, and so on.

The data in the table contains values of some of the variables in the BN. Learning in this case is computing

$P(\mathbf{\theta}| Data, BN)$

where $Data$ is the dataset, $BN$ is the bayesian network, and $\theta$ is the set of parameters. This is a standard inference in a BN!! If $\theta$ has a prior distribution, $P(\mathbf{\theta}| Data, BN)$ will compute a posterior distribution. But this is a distribution of values for each parameter. If for some reason you want a single number, then you may select the Maximum a-posteriori value for the parameters, that is the value that maximizes $P(\mathbf{\theta}| Data, BN)$

$MAP = argmax_{\theta} P(\mathbf{\theta}| Data, BN)$

Another alternative to compute a single number/set of numbers is not to consider the unknown probabilities as random variables in the BN, but as "simple" variables (unknown values) in the conditional probability tables. Then, a possible single number for these unknown probabilities are the values that maximize the probability of the data. This is called the Maximum Likelyhood estimation

$MLE = argmax_{\theta} P(Data | \mathbf{\theta}, BN)$

There are relations between MLE and MAP (see for example https://dsp.stackexchange.com/questions/64865/understanding-the-difference-between-map-estimation-and-ml-estimation)

If you are looking for the MLE or MAP there are simplified equations for some conditions regarding the priors of the parameters, and there is no need to compute the full BN inference of $P(\mathbf{\theta}| Data, BN)$.

In particular the calculations of the ratio of counting how many examples are in the dataset that you alluded in the question is the simplified equations for the MLE/MAP for random variables are that multinomial (multiple values) where the parameters are the entries in the conditional probability table, and where the priors for these parameters (unknown related probabilities) is a Dirichelet distribution.

But notice that in your data, variables such as A, C, BP, HP seems to be continuous, and thus they are not multinomial, and the counting formulas will not apply.

To summarize, the OP should check some of the literature on learning in BN.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.