f_model_importance_plot: plot model importance

Description Usage Arguments Value Examples

Description

optimised for usage in pipelearner dataframe

Usage

1
f_model_importance_plot(importance, title, variable_color_code = NULL)

Arguments

importance

dataframe importance created by f_model_importance()

title

character vector (model column in pipelearner dataframe) will be pasted for plot title

variable_color_code

dataframe created by f_plot_color_code_variables()

...

additional character vectors to be pasted to plot title

Value

plotly graph

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
data_ls = f_clean_data(mtcars)
variable_color_code = f_plot_color_code_variables(data_ls)
m = rpart::rpart(mtcars, disp~.)
imp = f_model_importance_rpart(m)
f_model_importance_plot(imp
                        , title = 'rpart'
                        , variable_color_code = variable_color_code
                        )
#pipelearner
pl = pipelearner::pipelearner(data_ls$data) %>%
  pipelearner::learn_models( rpart::rpart, disp~. ) %>%
  pipelearner::learn_models( randomForest::randomForest, disp~. ) %>%
  pipelearner::learn_models( e1071::svm, disp~. ) %>%
  pipelearner::learn() %>%
  mutate( imp = map2(fit, train, f_model_importance)
         , title = paste( model, models.id, cv_pairs.id, train_p )
         , plot = map2( imp
                       , title
                       , f_model_importance_plot
                       , variable_color_code = variable_color_code
                       )
         )
htmltools::tagList(pl$plot)

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