Calculation of log-likelihood in bnlearn

161 views Asked by At

I have created a Bayesian network model using the library bnlearn. I would like to calculate the log-likelihood of the model. Could you please let me know how can I do this? Sample code for creation of model:

bn = bn.fit(net, train)
nationprob = sumnations / sumallnations
cpt = coef(bn[["UserLocation"]])
cpt[1:length(EUROPE)] = nationprob
bn[["UserLocation"]] = cpt
cpt = coef(bn[["FriendsLocation"]])
cpt[1:length(EUROPE)] = nationprob
bn[["FriendsLocation"]] = cpt
bn.pred = predict(bn, node = "scaledsci", data = test) 
tabl1 = table(bn.pred, test[, "scaledsci"])
mn = mean(bn.pred == test$scaledsci)
0

There are 0 answers