bn.kcv.class: The bn.kcv class structure

Description Details Author(s)


The structure of an object of S3 class bn.kcv or bn.kcv.list.


An object of class bn.kcv.list is a list whose elements are objects of class bn.kcv.

An object of class bn.kcv is a list whose elements correspond to the iterations of a k-fold cross-validation. Each element contains the following objects:

  • test: an integer vector, the indexes of the observations used as a test set.

  • fitted: an object of class, the Bayesian network fitted from the training set.

  • loss: the value of the loss function.

If the loss function requires to predict values from the test sets, each element also contains:

  • predicted: a factor or a numeric vector, the predicted values for the target node in the test set.

  • observed: a factor or a numeric vector, the observed values for the target node in the test set.

In addition, an object of class bn.kcv has the following attributes:

  • loss: a character string, the label of the loss function.

  • mean: the mean of the values of the loss function computed in the k iterations of the cross-validation, which is printed as the "expected loss" or averaged to compute the "average loss over the runs".

  • bn: either a character string (the label of the learning algorithm to be applied to the training data in each iteration) or an object of class bn (a fixed network structure).


Marco Scutari

Search within the bnlearn package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.