importance_table: importance_table

Description Usage Arguments Details Value See Also Examples

Description

importance_table returns a data_frame of variable importance

Usage

1

Arguments

x

An rpart of gbm.step object to be turned into a tidy dataframe containing importance values

Details

This currently only works for rpart and gbm.step functions. In the future more features will be added so that it works for many decision trees

Value

A data_frame object made with the intention of turning it into a text table with 'knitr' or 'xtable'

See Also

https://github.com/dgrtwo/broom

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
32
33
34
35
36
37
38
39
40
41
42
43
44
# turn a fitted object into a data_frame

 \code{rpart} object
fit.rpart <- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis)

importance_table(fit.rpart)

# you can even use piping

fit.rpart %>% importance_table

\code{gbm.step} object
fit.gbm.step <- gbm.step(data = iris,
                         gbm.x = c(1:3),
                         gbm.y = 4,
                         tree.complexity = 1,
                         family = "gaussian",
                         learning.rate = 0.01,
                         bag.fraction = 0.5)

importance_table(fit.gbm.step)

# with piping
fit.gbm.step %>% importance_table

Unfortunately it cannot yet run a \code{gbm} object:
## Not run: 

gbm.fit <- gbm(Sepal.Width ~ .,
               distribution = "gaussian",
               data = iris)

importance_table(gbm.fit)

## End(Not run)

\code{randomForest} object
    set.seed(1)
    data(iris)
    iris.rf <- randomForest(Species ~ ., iris,
                            proximity=TRUE,
                            keep.forest=FALSE)

importance_table(iris.rf)

njtierney/neato documentation built on May 23, 2019, 8:22 p.m.