bins_tree {autoScorecard} | R Documentation |
Automatic Binning Based on Decision Tree Automatic Binning Based on Decision Tree(rpart).
Description
Automatic Binning Based on Decision Tree Automatic Binning Based on Decision Tree(rpart).
Usage
bins_tree(df, key_var, y_var, max_depth = 3, p = 0.1)
Arguments
df |
A data.frame with independent variables and target variable. |
key_var |
A name of index variable name. |
y_var |
A name of target variable. |
max_depth |
Set the maximum depth of any node of the final tree, with the root node counted as depth 0. Values greater than 30 rpart will give nonsense results on 32-bit machines. |
p |
Meet the following conversion formula: minbucket = round(p*nrow(df)).Smallest bucket(rpart):Minimum number of observations in any terminal <leaf> node. |
Value
A data frame, including the contents of the bin, the upper bound of the bin, the lower bound of the bin, and all the contents returned by the get_IV function.
Examples
accepts <- read.csv(system.file( "extdata", "accepts.csv", package = "autoScorecard" ))
feature <- stats::na.omit( accepts[,c(1,3,7:23)] )
all2 <- bins_tree(df = feature, key_var= "application_id", y_var= "bad_ind"
, max_depth = 3, p = 0.1 )
[Package autoScorecard version 0.3.0 Index]