f_model_importance_plot: plot model importance

Description Usage Arguments Value Examples

View source: R/f_model_imp.R

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()

variable_color_code

dataframe created by f_plot_color_code_variables()

model_name

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

models.id

character vector will be pasted for plot title

cv_pairs.id

character vector will be pasted for plot title

train_p

character vector will be pasted for plot title

...

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 = twidlr::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( twidlr::rpart, disp~. ) %>%
  pipelearner::learn_models( twidlr::randomForest, disp~. ) %>%
  pipelearner::learn_models( twidlr::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 Feb. 15, 2018, 5:12 p.m.