stages_bhcr: Backward random hill-climbing

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

stages_bhcrR Documentation

Backward random hill-climbing

Description

Randomly try to join stages. This is a pretty-useless function, used for comparisons.

Usage

stages_bhcr(
  object,
  score = function(x) {     return(-BIC(x)) },
  max_iter = 100,
  trace = 0
)

Arguments

object

an object of class sevt.

score

the score function to be maximized.

max_iter

the maximum number of iteration.

trace

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

Details

At each iteration a variable and two of its stages are randomly selected. If joining the stages increases the score, the model is updated. The procedure is repeated until the number of iterations reaches max_iter.

Value

an object of class sevt.

Examples

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

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