Learn R Programming

xgrove (version 0.1-15)

plot.xgrove: Plot surrogate grove statistics

Description

Plot statistics of surrogate groves to analyze complexity vs. explanatory power.

Usage

# S3 method for xgrove
plot(x, n.trees = NULL, abs = "rules", ord = "upsilon", ...)

Value

No return value.

Arguments

x

An object of class xgrove.

n.trees

Number of trees in case the effects of a grove should be visualized and abs and ord are ignored. If NULL a screeplot of complexity vs explanation is shown for abs vs. ord.

abs

Name of the measure to be plotted on the x-axis, either "trees", "rules", "upsilon" or "cor".

ord

Name of the measure to be plotted on the y-axis, either "trees", "rules", "upsilon" or "cor".

...

Further arguments passed to plot.

Examples

Run this code
library(randomForest)
library(pdp)
data(boston)
set.seed(42)
rf <- randomForest(cmedv ~ ., data = boston)
data <- boston[,-3] # remove target variable
ntrees <- c(4,8,16,32,64,128)
xg <- xgrove(rf, data, ntrees)
xg
plot(xg)

# alternatively, visualize weights for the grove of size 8:
plot(xg, n.trees = 8)

Run the code above in your browser using DataLab