Last chance! 50% off unlimited learning
Sale ends in
woe_trans
is for transforming data to woe.
The woe_trans_all
function is a simpler wrapper for woe_trans
.
woe_trans_all(
dat,
x_list = NULL,
ex_cols = NULL,
bins_table = NULL,
target = NULL,
breaks_list = NULL,
note = FALSE,
save_data = FALSE,
parallel = FALSE,
woe_name = FALSE,
file_name = NULL,
dir_path = tempdir(),
...
)woe_trans(
dat,
x,
bins_table = NULL,
target = NULL,
breaks_list = NULL,
woe_name = FALSE
)
A data.frame with independent variables.
A list of x variables.
Names of excluded variables. Regular expressions can also be used to match variable names. Default is NULL.
A table contians woe of each bin of variables, it is generated by codeget_bins_table_all,codeget_bins_table
The name of target variable. Default is NULL.
A list contains breaks of variables. it is generated by codeget_breaks_all,codeget_breaks
Logical, outputs info. Default is TRUE.
Logical, save results in locally specified folder. Default is TRUE
Logical, parallel computing. Default is FALSE.
Logical. Add "_woe" at the end of the variable name.
The name for periodically saved woe file. Default is "dat_woe".
The path for periodically saved woe file Default is "./data"
Additional parameters.
The name of an independent variable.
A list of breaks for each variables.
get_tree_breaks
, cut_equal
, select_best_class
, select_best_breaks
# NOT RUN {
sub = cv_split(UCICreditCard, k = 30)[[1]]
dat = UCICreditCard[sub,]
dat = re_name(dat, "default.payment.next.month", "target")
dat = data_cleansing(dat, target = "target", obs_id = "ID", occur_time = "apply_date",
miss_values = list("", -1))
train_test = train_test_split(dat, split_type = "OOT", prop = 0.7,
occur_time = "apply_date")
dat_train = train_test$train
dat_test = train_test$test
#get breaks of all predictive variables
x_list = c("PAY_0", "LIMIT_BAL", "PAY_AMT5", "EDUCATION", "PAY_3", "PAY_2")
breaks_list = get_breaks_all(dat = dat_train, target = "target",
x_list = x_list, occur_time = "apply_date", ex_cols = "ID",
save_data = FALSE, note = FALSE)
#woe transform
train_woe = woe_trans_all(dat = dat_train,
target = "target",
breaks_list = breaks_list,
woe_name = FALSE)
test_woe = woe_trans_all(dat = dat_test,
target = "target",
breaks_list = breaks_list,
note = FALSE)
# }
Run the code above in your browser using DataLab