Description Usage Arguments References Examples
View source: R/model.to.structure.R
Creates a Bayesian Network structure based on a high level semantic model.
1 | model.to.structure(model)
|
model |
Model string |
See online documentation http://robsonfernandes.net/bnviewer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | library(bnlearn)
library(bnviewer)
model.left.arrow.op1 = " A <- (B,C,D);
B <- (E,F);
F <- (G);
"
model.left.arrow.op2 = " A <= (B,C,D);
B <= (E,F);
F <= (G);
"
model.right.arrow.op1 = " A -> (B,C,D);
B -> (E,F);
F -> (G);
"
model.right.arrow.op2 = " A => (B,C,D);
B => (E,F);
F => (G);
"
structure = model.to.structure(model.left.arrow.op1)
viewer(structure,
bayesianNetwork.width = "100%",
bayesianNetwork.height = "80vh",
bayesianNetwork.layout = "layout_on_grid",
node.colors = list(background = "#f4bafd",
border = "#2b7ce9",
highlight = list(background = "#97c2fc",
border = "#2b7ce9"))
)
data.set = bnlearn::gaussian.test
bayesianNetwork.fit = bn.fit(structure, data = data.set)
print(bayesianNetwork.fit$A)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.