I use bnlearn package in R to learn the structure of my Bayesian Network and its parameters. What I want to do is to "predict" the value of a node given the value of other nodes as evidence (obviously, with the exception of the node whose values we are predicting). I have continuous variables. data(gaussian.test) training.set = gaussian.test[1:4000, ] # This is training set to learn the parameters test.set = gaussian.test[4001:4010, ] # This is test set to give as evidence res = hc(training.set) # learn BN structure on training set data fitted = bn.fit(res, training.set) # learning of parameters pred = predict(fitted$C, test.set) # predicts the value of node C given test set table(pred, test.set[, "C"]) # compares the predicted value as original Now, this code works well and gives a table in which you can see that predicted values for node C are **exactly** same as the original value of node C in test set. I do not understand the reason for that, could someone please explain it? I know, I am providing entire df of test set that already has the value of node C in it. But if I give the data of other columns, it gives an error. So, I tried an alternative of putting other values to 0. test.set$C = 0 # To not give the original value of node C as evidence pred = predict(fitted$C, test.set) # predicts the value of node C given test set table(pred, test.set[, "C"]) # compares the predicted value as original Is this approach wrong? (Using "NA" is not allowed.)