bnsl | R Documentation |
Wrapper function for executing general structure learning algorithms, much like rsmax2
from the bnlearn
package, with the addition of the partitioned PC (pPC) algorithm, the p-value adjacency thresholding (PATH) algorithm, and the hybrid greedy initialization (HGI) algorithm.
bnsl( x, restrict = "ppc", maximize = "tabu", restrict.args = list(), maximize.args = list(), undirected = FALSE, path = 1, min_alpha = 1e-05, hgi = FALSE, true_bn = NULL, whitelist = NULL, blacklist = NULL, debug = FALSE )
x |
a data frame containing the variables in the model. Currently, the implementations of pPC, PATH, and HGI only support discrete data. |
restrict |
an argument as in
|
maximize |
an argument as in |
restrict.args |
an argument as in
Additionally, |
maximize.args |
an argument as in |
undirected |
a logical value indicating, for constraint-based algorithms, whether the skeleton should be output without learning edge orientations. Not applicable for hybrid methods, score-based methods, or when |
path |
a numeric value indicating the number of solution(s) to be generated by the PATH algorithm. By default, PATH remains deactivated with |
min_alpha |
a numeric value between |
hgi |
a logical value activating the HGI algorithm for greedy edge orientation. Not applicable if |
true_bn |
a |
whitelist, blacklist, debug |
arguments as in |
None.
A Bayesian network as an object of class bn
.
Jireh Huang (jirehhuang@ucla.edu)
ppc
, phgs
## Read Bayesian network object true_bn <- bnrepository("child") ## Generate data and relevel for simplicity set.seed(1) x <- bnlearn::rbn(true_bn, n = 1e4) x <- as.data.frame(sapply(x, function(x) as.factor(as.integer(x) - 1L)), stringsAsFactors = TRUE) ## pPC with PATH bn1 <- bnsl(x = x, restrict = "ppc", maximize = "", restrict.args = list(alpha = 1e-3, max.sx = 3, sort_pval = TRUE), maximize.args = list(maxp = 8), path = 10, min_alpha = 1e-5, hgi = FALSE, debug = TRUE) ## pHGS (pPC with PATH, HGI, and greedy search) bn2 <- bnsl(x = x, restrict = "ppc", maximize = "tabu", restrict.args = list(alpha = 1e-3, max.sx = 3, sort_pval = TRUE), maximize.args = list(maxp = 8, tabu = 10, max.tabu = 10), path = 10, min_alpha = 1e-5, hgi = TRUE, debug = TRUE) ## MMHC with HGI bn3 <- bnsl(x = x, restrict = "mmpc", maximize = "hc", restrict.args = list(alpha = 1e-3, max.sx = 3, sort_pval = TRUE), maximize.args = list(maxp = 8), hgi = TRUE, debug = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.