phgs: The partitioned hybrid greedy search (pHGS) algorithm

View source: R/bnsl.R

phgsR Documentation

The partitioned hybrid greedy search (pHGS) algorithm

Description

Function for executing the partitioned hybrid greedy search (pHGS) algorithm, a combination of the partitioned PC (pPC) algorithm, the p-value adjacency thresholding (PATH) algorithm, and the hybrid greedy initialization (HGI) algorithm.

Usage

phgs(
  x,
  maximize = "tabu",
  maximize.args = NULL,
  alpha = NULL,
  max.sx = NULL,
  maxp = NULL,
  path = 1,
  min_alpha = 1e-05,
  max_wthn_sx = max.sx,
  max_btwn_sx = max.sx,
  max_btwn_nbr = ncol(x) - 2,
  sort_pval = TRUE,
  max_groups = 20,
  true_bn = NULL,
  cluster = NULL,
  whitelist = NULL,
  blacklist = NULL,
  debug = FALSE
)

Arguments

x, maximize, maximize.args, alpha, max.sx, maxp, path, min_alpha, max_wthn_sx, max_btwn_sx, max_btwn_nbr, sort_pval, max_groups, true_bn, cluster, whitelist, blacklist, debug

see bnsl for a description of arguments.

Details

See bnsl.

Value

A Bayesian network as an object of class bn.

Author(s)

Jireh Huang (jirehhuang@ucla.edu) #' @references Huang, J., & Zhou, Q. (2022). Partitioned hybrid learning of Bayesian network structures. Machine Learning. https://doi.org/10.1007/s10994-022-06145-4

See Also

bnsl, ppc

Examples

## 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)

## pHGS (pPC with PATH and HGI) with hill-climbing
bn1 <- phgs(x = x, maximize = "hc", 
            maximize.args = list(maxp = 8, restart = 10, perturb = 10),
            alpha = 1e-2, max.sx = 3, maxp = 8, path = 10,
            min_alpha = 1e-5, sort_pval = TRUE, max_groups = 20, 
            debug = TRUE)

## pHGS (pPC with PATH and HGI) with tabu search
bn2 <- phgs(x = x, maximize = "tabu", 
            maximize.args = list(maxp = 8, tabu = 10, max.tabu = 10),
            alpha = 1e-2, max.sx = 3, maxp = 8, path = 10,
            min_alpha = 1e-5, sort_pval = TRUE, max_groups = 20, 
            debug = TRUE)

jirehhuang/phsl documentation built on May 23, 2022, 4:19 a.m.