boot.strap.bn {bnpa} | R Documentation |
Executes a bootstrap during the learning of a BN structure
Description
This function receives a list of parameters, executes the bootstrap process and learn the Bayesian Network (BN) from the data set, then executes the process of model averaging to extract the final BN structure and print it.
Usage
boot.strap.bn(bn.algorithm, bn.score.test, data.to.work, black.list,
white.list, nreplicates = 1000, type.of.algorithm, outcome.var)
Arguments
bn.algorithm |
is a list of algorithms to learn the BN structure. |
bn.score.test |
is list of conditional independence tests and the network scores to be used. |
data.to.work |
is a data from which the BN structure will be learned. |
black.list |
is a list of forbiden connections of BN structure to be created. |
white.list |
is a list of mandatory connections of BN structure to be created. |
nreplicates |
is the number of replications to be done in the bootstrap process. |
type.of.algorithm |
is the type of algorithm to learn the BN sctructure, it would be constrained or score based. |
outcome.var |
is the variable to be used as outcome (dependent) and be highlighted in the BN. |
Value
The final BN structure learned.
Author(s)
Elias Carvalho
References
Claeskens N, Hjort N (2009) Model selection and model avaraging. Cambridge University Press, Cambridge, England.
Koller D, Friedman N (2009) Probabilistic graphical models: principles and techniques. MIT Press, Cambridge.
Scutari M (2017). Bayesian Network Constraint-Based Structure Learning Algorithms: Parallel and Optimized Implementations in the bnlearn R Package. Journal of Statistical Software, 77(2), 1-20.
Examples
## Not run:
# Clean environment
closeAllConnections()
rm(list=ls())
# Set enviroment
# setwd("to your working directory")
# Load packages
library(bnpa)
# Use working data sets from package
data(dataQualiN)
# Start the cluster
cl <- bnpa::create.cluster()
# Set the number of replications
nreplicates=1000
# Set the algorithm to be used
bn.algorithm="hc"
# Executes a parallel bootstrap process
data.bn.boot.strap=bnlearn::boot.strength(data = dataQualiN, R = nreplicates, algorithm =
bn.algorithm, cluster=cl, algorithm.args=list(score="bic"), cpdag = FALSE)
# Release the cluster
parallel::stopCluster(cl)
head(data.bn.boot.strap)
## End(Not run)