Displaying 1 result from an estimated 1 matches for "evidence_data".
2013 Oct 09
1
Using "cpquery" function from bnlearn package inside loop
...provided by the author.
Any help you could provide would be great. I'm eager to find a way that I can apply the cpquery function for a large number of observations.
library(bnlearn)
data(learning.test)
fitted = bn.fit(hc(learning.test), learning.test)
bn.function <- function(network, evidence_data) {
a <- NULL
b <- nrow(evidence_data)
for (i in 1:b) {
evi <- paste("(", names(evidence_data), "=='",
sapply(evidence_data[i,], as.character), "')",
sep = "", collapse = " & ")...