0
$\begingroup$

Given a Bayesian network consisting of n random variables. What is the algorithm to generate the dataset from the given structure and associated conditional probability table for each random variable xi.

$\endgroup$
  • $\begingroup$ bnlearn can do this for a small class of BN's. For more exotic distributions, you will need to generate random samples from the given distribution given the graph structure and paramters. $\endgroup$ – user2957945 Jun 13 '18 at 11:40
  • $\begingroup$ Yes, I am interested in how to generate those random samples given the graph structure and parameters $\endgroup$ – letsBeePolite Jun 13 '18 at 19:37
  • $\begingroup$ Generate the random distributions on the nodes without parents according to their distribution and parameters. Then update the children, according to the associations and the random generations of their parents. eg. say you have the graph A -> C <- B, and the parameters A ~ normal(0,1) ; B ~ normal(0,1) ; C ~ normal(1 + 2*A + B, 2^2) one way you can code this in R with sample size n=1000 . Generate parents nodes distributions A = rnorm(n, 0, 1) ; B = rnorm(n, 0, 1) , then the child C = rnorm(n, 1 + 2*A + B, 2^2) ; dat = data.frame(A, B, C) . $\endgroup$ – user2957945 Jun 13 '18 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.