by zgong001 » Thu Mar 28, 2019 10:17 am
Some r function to do Bayesian network analysis.
install.packages("bnlearn")
library(bnlearn)
data = read.table("data.txt", header = TRUE)
score(dag, data = marks, type = "loglik-g") -- get the score of the network
bnlearn::score(dag, data, type = "bge", iss = 5)
vstructs(dag) - v structure
graphviz.plot(dag2, highlight = hl2, layout = "fdp",
main = "dag2") --- plot the network
The following is some structure learning algorithm.
bn.gs = gs(data)
bn.iamb = iamb(data)
bn.iamb2 = iamb(data, test = "mc-cor")
bn.hc = hc(data)
- Attachments
-
- Bayesian Networks in R.pdf
- (1.63 MiB) Downloaded 183 times