rfPermute (version 2.1.81)

impHeatmap: Importance Heatmap

Description

Plot heatmap of importance scores or ranks from a classification model

Usage

impHeatmap(
  rf,
  n = NULL,
  ranks = TRUE,
  plot = TRUE,
  xlab = NULL,
  ylab = NULL,
  scale = TRUE,
  alpha = 0.05
)

Arguments

rf

an object inheriting from randomForest.

n

Plot n most important predictors.

ranks

plot ranks instead of actual importance scores?

plot

print the plot?

xlab, ylab

labels for the x and y axes.

scale

For permutation based measures, should the measures be divided their "standard errors"?

alpha

a number specifying the critical alpha for identifying predictors with importance scores significantly different from random. This parameter is only relevant if rf is a rfPermute object with p-values. Importance measures with p-values less than alpha will be denoted in the heatmap by a black border. If set to NULL, no border is drawn.

Value

the ggplot object is invisibly returned.

Details

rf must be a classification model run with importance = TRUE.

Examples

Run this code
# NOT RUN {
data(mtcars)

# A randomForest model
rf <- randomForest(factor(am) ~ ., mtcars, importance = TRUE)
importance(rf)
impHeatmap(rf, xlab = "Transmission", ylab = "Predictor")

# An rfPermute model with significant predictors identified
rp <- rfPermute(factor(am) ~ ., mtcars, nrep = 100, num.cores = 1)
impHeatmap(rp, xlab = "Transmission", ylab = "Predictor")

# }

Run the code above in your browser using DataLab