make_tree: A utility function for generating random trees for test...

View source: R/utils.R

make_treeR Documentation

A utility function for generating random trees for test purposes.

Description

Build a depth depth tree by drawing random split variables and split values from the Nxp matrix X. In leaf nodes a random action is drawn from 1:d. (Minimum leaf size will be 1)

Usage

make_tree(X, depth, d)

Arguments

X

data matrix.

depth

tree depth.

d

number of actions.

Value

A policy_tree tree object

Examples

## Not run: 
depth <- 2
n <- 100
p <- 10
d <- 3
X <- matrix(rnorm(n * p), n, p)
Y <- matrix(rnorm(n * d), n, d)
tree <- make_tree(X, depth = depth, d = d)
pp <- predict_test_tree(tree, X)

## End(Not run)

policytree documentation built on July 9, 2023, 6:30 p.m.