f_model_importance_plot_tableplot: tableplot of important variables

Description Usage Arguments Value See Also Examples

Description

takes the most important variables of a model and plots a tabplot::tableplot

Usage

1
2
f_model_importance_plot_tableplot(data, ranked_variables, response_var,
  limit = 10, print = F, ...)

Arguments

data

dataframe

ranked_variables

datafram as returned by f_model_importance()

response_var

character vector denoting response variable

limit

integer limit the number of variables , Default: 10

print

boolean, print tabplot when generating tabplot object

...

pass kwargs to tabplot::tableplot

Value

tabplot::tableplot object

See Also

tableplot

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
data = f_clean_data(mtcars) %>%
  .$data
m = rpart::rpart( disp~., data)
ranked_variables  = f_model_importance(m, data)
response_var = 'disp'

f_model_importance_plot_tableplot( data, ranked_variables, response_var, limit = 5 )

#pipe
form = as.formula('disp~cyl+mpg+hp')
pl = pipelearner::pipelearner(mtcars) %>%
 pipelearner::learn_models( rpart::rpart, form ) %>%
 pipelearner::learn_models( randomForest::randomForest, form ) %>%
 pipelearner::learn_models( e1071::svm, form ) %>%
 pipelearner::learn() %>%
 mutate( imp = map2(fit, train, f_model_importance)
         , tabplot = pmap( list( data = train
                                 , ranked_variables = imp
                                 , response_var = target
                                 , title = model
         )
         , f_model_importance_plot_tableplot
         , limit = 5
         )
  )

erblast/oetteR documentation built on May 27, 2019, 12:11 p.m.