0

我使用库创建了一个贝叶斯网络模型bnlearn。我想计算log-likelihood模型的。你能告诉我我该怎么做吗?创建模型的示例代码:

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)
4

0 回答 0