Description Usage Arguments Value Examples
This is a wrapper for the get_terminal_node_paths
or
get_terminal_node_directions
functions to do input checking and return
results in a better form (data.frame
)
1 | terminal_node_exprs(split_exprs, terminal_node_paths = TRUE)
|
split_exprs |
|
terminal_node_paths |
should decision paths (A > 10 & b < 3 etc) be
returned, or directions (LRLL etc)? Default is |
data.frame
containing complete split conditions for terminal
nodes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | library(h2o)
h2o.init()
prostate.hex = h2o.uploadFile(path = system.file("extdata",
"prostate.csv",
package = "h2o"),
destination_frame = "prostate.hex")
prostate.hex$RACE <- as.factor(prostate.hex$RACE)
prostate.hex$DPROS <- as.factor(prostate.hex$DPROS)
prostate.gbm = h2o.gbm(x = c("AGE", "RACE", "DPROS", "DCAPS", "PSA", "VOL", "GLEASON"),
y = "CAPSULE",
training_frame = prostate.hex,
ntrees = 5,
max_depth = 5,
learn_rate = 0.1)
h2o_trees <- H2OTreeConvertR::h2o_tree_convertR(prostate.gbm)
tree_1_split_expr <- get_split_expressions(h2o_trees[[1]])
# return paths
tree_1_terminal_nodes_df <- terminal_node_exprs(df = tree_1_split_expr)
# return directions
tree_1_terminal_nodes_df2 <- terminal_node_exprs(df = tree_1_split_expr,
terminal_node_paths = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.