ppc: The partitioned PC (pPC) algorithm

View source: R/bnsl.R

ppcR Documentation

The partitioned PC (pPC) algorithm

Description

Function for executing the partitioned PC (pPC) algorithm, including the option to use the p-value adjacency thresholding (PATH) algorithm.

Usage

ppc(
  x,
  undirected = FALSE,
  alpha = NULL,
  max.sx = NULL,
  maxp = NULL,
  path = 1,
  min_alpha = 1e-05,
  hgi = FALSE,
  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, undirected, alpha, max.sx, maxp, path, min_alpha, hgi, 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.

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, phgs

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)

## pPC with PATH
bn1 <- ppc(x = x, alpha = 1e-2, max.sx = 3, maxp = 8, path = 10,
           min_alpha = 1e-5, sort_pval = TRUE, max_groups = 20, 
           debug = TRUE)

## PC(-stable) with PATH
bn2 <- ppc(x = x, alpha = 1e-2, max.sx = 3, maxp = 8, path = 10,
           min_alpha = 1e-5, sort_pval = TRUE, max_groups = 1, 
           debug = TRUE)

## pPC with PATH and HGI (no greedy search)
bn3 <- ppc(x = x, alpha = 1e-2, max.sx = 3, maxp = 8, path = 10,
           min_alpha = 1e-5, hgi = TRUE, sort_pval = TRUE, 
           max_groups = 20, debug = TRUE)

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