importancePlot: importancePlot

Description Usage Arguments Examples

View source: R/importancePlot.R

Description

This function is used to plot just the variable importance.

Usage

1
2
3
4
5
6
7
8
9
importancePlot(
  mat,
  plotType = "lollipop",
  pal = rev(sequential_hcl(palette = "Reds 3", n = 11)),
  fitlims = NULL,
  top = NULL,
  label,
  ...
)

Arguments

mat

A matrix of values to be plotted. Either added by the user or created using the prepFunc() function.

pal

A vector of colors to show predictions, for use with scale_fill_gradientn

fitlims

Specifies the fit range for the color map for importance.

top

A value set by the user to only display the top x amount variables.

label

Only compatible with plotType = "barplot". If TRUE then the importance value is displayed at the end of each bar.

...

Not currently implemented

type

The type of plot to display, either "lollipop" (default), or "barplot".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Load in the data:
aq <- data.frame(airquality)
aq <- na.omit(aq)

# Run an mlr ranger model:
library(mlr3)
library(mlr3learners)
library(ranger)
aq_Task <- TaskRegr$new(id = "airQ", backend = aq, target = "Ozone")
aq_lrn <- lrn("regr.ranger", importance = "permutation")
aq_Mod <- aq_lrn$train(aq_Task)

# Create matrix
myMat <- vividMatrix(task = aq_Task,  model = aq_Mod)

# Create plot:
plot(myMat, type = "importance")

AlanInglis/vividOld documentation built on March 4, 2021, 12:44 a.m.