Learn R Programming

stagedtrees (version 2.3.0)

stages_bhcr: 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
)

Value

an object of class sevt.

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.

Examples

Run this code
DD <- generate_xor_dataset(p = 4, n = 100)
model <- stages_bhcr(full(DD), trace = 2)
summary(model)

Run the code above in your browser using DataLab