Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

woebin_ply

WOE/BIN Transformation


Description

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

Usage

woebin_ply(dt, bins, to = "woe", no_cores = NULL, print_step = 0L,
  replace_blank_inf = TRUE, ...)

Arguments

dt

A data frame.

bins

Binning information generated from woebin.

to

Converting original values to woe or bin. Defaults to woe.

no_cores

Number of CPU cores for parallel computation. Defaults to 90 percent of total cpu cores.

print_step

A non-negative integer. Defaults to 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_inf

Logical. Replace blank values with NA and infinite with -1. Defaults to 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")

# converting to woe
dt_woe = woebin_ply(dt, bins=bins)
str(dt_woe)

# converting to bin
dt_bin = woebin_ply(dt, bins=bins, to = 'bin')
str(dt_bin)


# Example II
# binning for germancredit dataset
bins_germancredit = woebin(germancredit, y="creditability")

# converting the values in germancredit to woe
# bins is a list which generated from woebin()
germancredit_woe = woebin_ply(germancredit, bins_germancredit)

# bins is a data frame
bins_df = data.table::rbindlist(bins_germancredit)
germancredit_woe = woebin_ply(germancredit, bins_df)

scorecard

Credit Risk Scorecard

v0.3.2
MIT + file LICENSE
Authors
Shichen Xie [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.