
Predict values based on fitted policy_tree object.
# S3 method for policy_tree
predict(object, newdata, ...)
policy_tree object
A data frame with features
Additional arguments (currently ignored).
A vector of predictions. Each element is an integer from 1 to d where d is the number of columns in the reward matrix.
# NOT RUN {
n <- 50
p <- 10
d <- 3
features <- matrix(rnorm(n * p), n, p)
rewards <- matrix(rnorm(n * d), n, d)
tree <- policy_tree(features, rewards, depth = 2)
print(tree)
predict(tree, features)
# }
Run the code above in your browser using DataLab