stages_fbhc: Fast backward hill-climbing

View source: R/4-model-selection.R

stages_fbhcR Documentation

Fast backward hill-climbing

Description

Greedy search of staged event trees with iterative joining of stages.

Usage

stages_fbhc(
  object = NULL,
  score = function(x) {     return(-BIC(x)) },
  max_iter = Inf,
  scope = NULL,
  ignore = object$name_unobserved,
  trace = 0
)

Arguments

object

an object of class sevt with fitted probabilities and data, as returned by full or sevt_fit.

score

the score function to be maximized.

max_iter

the maximum number of iteration.

scope

names of variables that should be considered for the optimization.

ignore

vector of stages which will be ignored and left untouched, by default the name of the unobserved stages stored in object$name_unobserved.

trace

if >0 increasingly amount of info is printed (via message).

Details

For each variable the algorithm tries to join stages and moves to the first model that increases the score. When no increase is possible it moves to the next variable.

Value

The final staged event tree obtained.

Examples

DD <- generate_xor_dataset(n = 5, N = 100)
model <- stages_fbhc(full(DD), trace = 2)
summary(model)

stagedtrees documentation built on April 29, 2022, 1:06 a.m.