Description Usage Arguments Details Value Examples
Function that bins selected variable(s) and returns a dataframe with binned values. Uses greedy binning algorithm to perform coarse binning of selected variable(s).
1 2 3 4 5 6 7 8 9 10 11 |
dat |
Dataframe of that contains ID, binary target and variables to be binned. |
id |
ID variable. See 'Details'. |
target |
The binary taget/response variable for WOE. See 'Details'. |
varcol |
Vector of variables to be binned. |
minimum.cat |
Minimum number of bins. |
num.bins |
Target number of bins.
Overridden by the number of levels if |
min.pts.bin |
Minimum number of observations in a bin. |
bracket |
Indicating if the intervals should be closed on the right or
left. Options include |
special.values |
A vector of values that should have their own bin. See 'Details'. |
The id
and the target
variables must be provided.
Works for numeric, factor and binary target
. To build a scorecard,
a binary target
is required.
Actual number of bins exceeds num.bins
if
special.values
specified.
A dataframe containing the ID, target, and binned variable(s) with corresponding binned vlues.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | mydata <- ISLR::Default
head(mydata)
mydata$ID <- seq(1:nrow(mydata)) ## make an ID variable
mydata$default <- ifelse(mydata$default=="Yes", 1, 0) ## target coded with 1, 0
## bin balance and income
binned1 <- BinProfet(mydata, id="ID", target="default",
varcol = c("balance", "income"), num.bins = 5)
head(binned1)
## bin categorical variable-------------------
binned2 <- BinProfet(mydata, id="ID", target="default",
varcol = "student", num.bins = 5)
head(binned2)
summary(binned2$student_Bins) ## num.bins overriden
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.