importance_plot: importance_plot

Description Usage Arguments Details Value Examples

View source: R/importance_plot.R

Description

importance_plot make a graph of variable importance

Usage

1

Arguments

x

is an rpart or gbm.step object

...

extra functions or arguments

Details

takes an 'rpart' or 'gbm.step' fitted object and makes a plot of variable importance

Value

a ggplot plot of the variable importance

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Not run: 
 # an rpart object
 library(rpart)
 library(treezy)
fit.rpart <- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis)

importance_plot(fit.rpart)

# you can even use piping

fit.rpart %>% importance_plot

 # a randomForest object

 set.seed(131)
  ozone.rf <- randomForest(Ozone ~ ., data=airquality, mtry=3,
                           importance=TRUE, na.action=na.omit)
  print(ozone.rf)
  ## Show "importance" of variables: higher value mean more important:
  importance(ozone.rf)

  ## use importance_table

  importance_table(ozone.rf)

  # now plot it

  importance_plot(ozone.rf)


## End(Not run)

njtierney/treezy documentation built on Oct. 10, 2019, 1:08 a.m.