Description Usage Arguments Details Value See Also Examples
Auxiliary function: smbinning2
is an enhanced and integrated optimal binning function for score model, which contains 4 different binning methods(see details) for numeric and factor variables.
1 | smbinning2(df, x, binMethod, p, maxcat, aliquots)
|
df |
A dataframe only with Xs and Y variables, and the last variable must be Y, see details. |
x |
A name character of one x variable(if x variable is a character variable, it must be converted to factor in advance), |
binMethod |
An integer from 1 to 4, indicates 4 different binning methods(see details). |
p |
A numeric, means percentage of records per bin, from 0 to 0.5. |
maxcat |
An integer, specifies the maximum number of categories. |
aliquots |
An integer, specifies the number of bins for equal-frequency or equal-interval binning method. |
the last variable in df
must be binary response variable (0,1). Integer (int) is required. Name of y must not have a dot. Name "default" is not allowed.
binMethod=c(1,2,3,4)
, meanings:
1 means optimal binning, and equal-frequency binning is an alternative when optimal binning is not available.
2 means optimal binning, and equal-interval binning is an alternative when optimal binning is not available.
3 means equal-frequency binning.
4 means equal-interval binning.
when x
represents a continuous variable: At least 5 different values(excluding NA). Value Inf is not allowed.
when x
represents a factor variable: At least 2 different values(excluding NA). Value Inf is not allowed.
A dataframe with cutpoints and corresponding woes
Other dataset binning and woe-encoding functions: convertCutPoints
,
dfBinningFun
,
executeBinFun_df
,
genConfigList
, preBinningFun
,
woeEncodeFun_df
1 2 3 4 5 6 | data(CreditData)
mysample <- convertType(CreditData, toType="fac")
splitresult <- splitData(mysample, size = 0.7, ifpercent = TRUE)
train <- splitresult[[1]]
test <- splitresult[[2]]
smbinning2(train, x = "bscore", binMethod = 1, p = 0.05, maxcat = 10, aliquots = 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.