Learn R Programming

Rforestry (version 0.11.1.0)

plot-forestry: visualize a tree

Description

plots a tree in the forest.

Usage

# S3 method for forestry
plot(x, tree.id = 1, print.meta_dta = FALSE, beta.char.len = 30, ...)

Arguments

x

A forestry x.

tree.id

Specifies the tree number that should be visulaized.

print.meta_dta

Should the data for the plot be printed?

beta.char.len

The length of the beta values in leaf node representation.

...

additional arguments that are not used.

Examples

Run this code
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 = 10,
  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 = 10)

Run the code above in your browser using DataLab