plot-forestry: visualize a tree

Description Usage Arguments Examples

Description

Plots a single tree in the forest.

Usage

1
2
3
4
5
6
7
8
9
## S3 method for class 'forestry'
plot(
  x,
  tree.id = 1,
  print.meta_dta = FALSE,
  beta.char.len = 30,
  return.plot.dta = FALSE,
  ...
)

Arguments

x

A trained model object of class "forestry".

tree.id

Specifies the tree number that should be visualized

print.meta_dta

Should the data for the plot be printed?

beta.char.len

The length of the beta values in leaf node representation.

return.plot.dta

If TRUE no plot will be generated, but instead a list with all the plot data is returned.

...

additional arguments that are not used.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
set.seed(292315)
rf <- forestry(x = iris[,-1],
               y = iris[, 1])

plot(x = rf)
plot(x = rf, tree.id = 2)
plot(x = rf, tree.id = 500)

ridge_rf <- forestry(
  x = iris[,-1],
  y = iris[, 1],
  replace = FALSE,
  nodesizeStrictSpl = 10,
  mtry = 4,
  ntree = 1000,
  minSplitGain = .004,
  linear = TRUE,
  overfitPenalty = 1.65,
  linFeats = 1:2)

plot(x = ridge_rf)
plot(x = ridge_rf, tree.id = 2)
plot(x = ridge_rf, tree.id = 1000)

soerenkuenzel/forestry documentation built on April 25, 2021, 10:02 a.m.