Description Usage Arguments Value Author(s) References Examples
View source: R/boot.strap.bn.R
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.
1 2 | boot.strap.bn(bn.algorithm, bn.score.test, data.to.work, black.list,
white.list, nreplicates = 1000, type.of.algorithm, outcome.var)
|
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. |
The final BN structure learned.
Elias Carvalho
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.