woebin_ply converts original input data into woe values based on the binning information generated from woebin.

woebin_ply(dt, bins, no_cores = NULL, print_step = 0L,
  replace_blank_na = TRUE, ...)

Arguments

dt

A data frame.

bins

Binning information generated from woebin.

no_cores

Number of CPU cores for parallel computation. Defaults NULL. If no_cores is NULL, the no_cores will set as 1 if length of x variables less than 10, and will set as the number of all CPU cores if the length of x variables greater than or equal to 10.

print_step

A non-negative integer. Default is 1. If print_step>0, print variable names by each print_step-th iteration. If print_step=0 or no_cores>1, no message is print.

replace_blank_na

Logical. Replace blank values with NA. Default is TRUE. This argument should be the same with woebin's.

...

Additional parameters.

Value

A data frame with columns for variables converted into woe values.

See also

Examples

# load germancredit data data(germancredit) # Example I dt = germancredit[, c("creditability", "credit.amount", "purpose")] # binning for dt bins = woebin(dt, y = "creditability")
#> [INFO] creating woe binning ...
# converting original value to woe dt_woe = woebin_ply(dt, bins=bins)
#> [INFO] converting into woe values ...
str(dt_woe)
#> Classes ‘data.table’ and 'data.frame': 1000 obs. of 3 variables: #> $ creditability : Factor w/ 2 levels "bad","good": 2 1 2 2 1 2 2 2 2 1 ... #> $ credit.amount_woe: num 0.0337 0.3905 -0.2583 0.3905 0.3905 ... #> $ purpose_woe : num -0.41 -0.41 0.28 0.28 0.28 ... #> - attr(*, ".internal.selfref")=<externalptr>
# Example II # binning for germancredit dataset bins_germancredit = woebin(germancredit, y="creditability")
#> [INFO] creating woe binning ...
# converting the values in germancredit to woe # bins is a list which generated from woebin() germancredit_woe = woebin_ply(germancredit, bins_germancredit)
#> [INFO] converting into woe values ...
# bins is a data frame bins_df = data.table::rbindlist(bins_germancredit) germancredit_woe = woebin_ply(germancredit, bins_df)
#> [INFO] converting into woe values ...
# return value is bin but not woe germancredit_bin = woebin_ply(germancredit, bins_germancredit, value = 'bin')
#> [INFO] converting into woe values ...