130 Bayesian Networks: With Examples in R
The first step is implemented in the cnSearchSA function using simu-
lated annealing, which we apply below to the discretised marks data from
bnlearn. Learning can be customised with several optional arguments such as
the maximum number of parents allowed for each node (maxParentSet and
parentSizes), the maximum complexity of the network (maxComplexity) and
the prior probability of inclusion of each arc (edgeProb).
> library(catnet)
> dmarks <- discretize(marks, breaks = 2, method = "interval")
> ord <- cnSearchSA(dmarks, maxParentSet = 2)
> ord
Number of nodes = 6,
Sample size = 88,
Number of networks = 14
Processing time = 0.122
ord is an object of class catNetworkEvaluate, which contains a set of net-
works with ...