plot.pre: Plot method for class pre

View source: R/pre.R

plot.preR Documentation

Plot method for class pre

Description

plot.pre creates one or more plots depicting the rules in the final ensemble as simple decision trees.

Usage

## S3 method for class 'pre'
plot(
  x,
  penalty.par.val = "lambda.1se",
  gamma = NULL,
  linear.terms = TRUE,
  nterms = NULL,
  fill = "white",
  ask = FALSE,
  exit.label = "0",
  standardize = FALSE,
  plot.dim = c(3, 3),
  ...
)

Arguments

x

an object of class pre.

penalty.par.val

character or numeric. Value of the penalty parameter \lambda to be employed for selecting the final ensemble. The default "lambda.min" employs the \lambda value within 1 standard error of the minimum cross-validated error. Alternatively, "lambda.min" may be specified, to employ the \lambda value with minimum cross-validated error, or a numeric value >0 may be specified, with higher values yielding a sparser ensemble. To evaluate the trade-off between accuracy and sparsity of the final ensemble, inspect pre_object$glmnet.fit and plot(pre_object$glmnet.fit).

gamma

Mixing parameter for relaxed fits. See coef.cv.glmnet.

linear.terms

logical. Should linear terms be included in the plot?

nterms

numeric. The total number of terms (or rules, if linear.terms = FALSE) being plotted. Default is NULL, resulting in all terms of the final ensemble to be plotted.

fill

character of length 1 or 2. Background color(s) for terminal panels. If one color is specified, all terminal panels will have the specified background color. If two colors are specified (the default, the first color will be used as the background color for rules with a positively valued coefficient; the second color for rules with a negatively valued coefficient.

ask

logical. Should user be prompted before starting a new page of plots?

exit.label

character string. Label to be printed in nodes to which the rule does not apply (“exit nodes”)?

standardize

logical. Should printed importances be standardized? See importance.pre.

plot.dim

integer vector of length two. Specifies the number of rows and columns in the plot. The default yields a plot with three rows and three columns, depicting nine baselearners per plotting page.

...

Arguments to be passed to gpar.

See Also

pre, print.pre

Examples

set.seed(42)
 airq.ens <- pre(Ozone ~ ., data = airquality[complete.cases(airquality),])
 plot(airq.ens)

pre documentation built on May 29, 2024, 5:10 a.m.