extract_split_rules: Get split conditions for terminal nodes for all trees in...

Description Usage Arguments Value Examples

Description

This function takes the output from H2OTreeConvertR::h2o_tree_convertR and for each tree in the model determines the split conditions required to reach the terminal nodes.

Usage

1
extract_split_rules(h2o_trees_R, terminal_node_paths = TRUE)

Arguments

h2o_trees_R

list output from the H2OTreeConvertR::h2o_tree_convertR function.

terminal_node_paths

should decision paths (A > 10 & b < 3 etc) be returned, or directions (LRLL etc)? Default is TRUE.

Value

list containing split conditions to reach terminal nodes for each tree.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)

h2o_trees_terminal_node_rules <- extract_split_rules(h2o_trees)

richardangell/h2oTreeHelpR documentation built on July 3, 2019, 7:35 a.m.