get_plots {creditmodel}R Documentation

Plot Independent Variables Distribution

Description

You can use the plot_vars to produce plots that characterize the frequency or the distribution of your data. get_plots can loop through plots for all specified independent variables.

Usage

get_plots(
  dat_train,
  dat_test = NULL,
  x_list = NULL,
  target = NULL,
  ex_cols = NULL,
  breaks_list = NULL,
  pos_flag = NULL,
  equal_bins = FALSE,
  cut_bin = "equal_depth",
  best = TRUE,
  g = 20,
  tree_control = NULL,
  bins_control = NULL,
  fill_colors = love_color(type = "lightnihon_6x1"),
  plot_show = TRUE,
  save_data = FALSE,
  file_name = NULL,
  parallel = FALSE,
  g_width = 8,
  dir_path = tempdir()
)

plot_vars(
  dat_train,
  x,
  target,
  dat_test = NULL,
  g_width = 8,
  breaks_list = NULL,
  breaks = NULL,
  pos_flag = list("1", 1, "bad", "positive"),
  equal_bins = TRUE,
  cut_bin = "equal_depth",
  best = FALSE,
  g = 10,
  tree_control = NULL,
  bins_control = NULL,
  fill_colors = love_color(type = "lightnihon_6x1"),
  plot_show = TRUE,
  save_data = FALSE,
  dir_path = tempdir()
)

Arguments

dat_train

A data.frame with independent variables and target variable.

dat_test

A data.frame of test data. Default is NULL.

x_list

Names of independent variables.

target

The name of target variable.

ex_cols

A list of excluded variables. Regular expressions can also be used to match variable names. Default is NULL.

breaks_list

A table containing a list of splitting points for each independent variable. Default is NULL.

pos_flag

Value of positive class, Default is "1".

equal_bins

Logical, generates initial breaks for equal frequency or width binning.

cut_bin

A string, if equal_bins is TRUE, 'equal_depth' or 'equal_width', default is 'equal_depth'.

best

Logical, merge initial breaks to get optimal breaks for binning.

g

Number of initial breakpoints for equal frequency binning.

tree_control

Parameters of using Decision Tree to segment initial breaks. See detials: get_tree_breaks

bins_control

Parameters used to control binning. See detials: select_best_class, select_best_breaks

fill_colors

Colors of plots.See detials: love_color,select some beatiful colors.

plot_show

Logical, show model performance in current graphic device. Default is FALSE.

save_data

Logical, save results in locally specified folder. Default is FALSE.

file_name

The name for periodically saved data file. Default is NULL.

parallel

Logical, parallel computing. Default is FALSE.

g_width

The width of graphs.

dir_path

The path for periodically saved graphic files.

x

The name of an independent variable.

breaks

Splitting points for an independent variable. Default is NULL.

Examples

train_test = train_test_split(UCICreditCard[1:1000,], split_type = "Random",
 prop = 0.8, save_data = FALSE)
dat_train = train_test$train
dat_test = train_test$test
get_plots(dat_train[, c(8, 26)], dat_test = dat_test[, c(8, 26)],
target = "default.payment.next.month")

[Package creditmodel version 1.3.0 Index]