f_model_importance_pl_add_plots_regression: add plots based on variable importance to pipelearner...

Description Usage Arguments Value See Also Examples

Description

adds a bar plot of the ranked variables, a tabplot sorted by the target variable and a dependency plot (response variable vs the sequential range of one of the predictor variables while all other predictors are kept constant at mean values).

Usage

1
2
3
4
5
f_model_importance_pl_add_plots_regression(pl, data, m, ranked_variables,
  response_var, title,
  variable_color_code = f_plot_color_code_variables(data_ls), formula,
  data_ls, var_dep_limit = 10, var_dep_log_y = F, tabplot_limit = 12,
  formula_in_pl = F)

Arguments

pl

a dataframe containing the columns for data, m, ranked_variables, response_var and title

data

symbol (unquoted name) of data column in pl

m

symbol (unquoted name) of data column in pl

ranked_variables

symbol (unquoted name) of data column in pl

response_var

symbol (unquoted name) of data column in pl

title

symbol (unquoted name) of data column in pl

variable_color_code

dataframe created by f_plot_color_code_variables()

formula

fomula that was used to construct model

data_ls

data_ls list object containing the whole of the original data

var_dep_limit

number of variables to be plotted on dependency plot

var_dep_log_y

should y axis of dependency plot be logarithmic

tabplot_limit

number of variables to be plotted on tabplot

formula_in_pl

boolean if formula is a column in pl?

Value

dataframe

See Also

f_model_importance_plot f_model_importance_plot_tableplot f_model_plot_variable_dependency_regression

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
data_ls = f_clean_data(mtcars)
form = disp~cyl+mpg+hp
variable_color_code = f_plot_color_code_variables(data_ls)

pl = pipelearner::pipelearner(data_ls$data) %>%
  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)
          , title = paste(model, models.id, train_p) ) %>%
  f_model_importance_pl_add_plots_regression(  data                  = train
                                               , m                   = fit
                                               , ranked_variables    = imp
                                               , title               = title
                                               , response_var        = target
                                               , variable_color_code = variable_color_code
                                               , formula             = form
                                               , data_ls             = data_ls
                                               , var_dep_limit       = 10
                                               , var_dep_log_y       = T
                                               , tabplot_limit       = 12 )

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