binning_kmean {autoScorecard} | R Documentation |
The K-means Binning The k-means binning method first gives the center number, classifies the observation points using the Euclidean distance calculation and the distance from the center point, and then recalculates the center point until the center point no longer changes, and uses the classification result as the binning of the result.
Description
The K-means Binning The k-means binning method first gives the center number, classifies the observation points using the Euclidean distance calculation and the distance from the center point, and then recalculates the center point until the center point no longer changes, and uses the classification result as the binning of the result.
Usage
binning_kmean(df, feat, label, nbins = 3)
Arguments
df |
A data.frame with independent variables and target variable. |
feat |
A name of index variable name. |
label |
A name of target variable. |
nbins |
Number of bins,default:3. |
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)] )
ddd <- binning_kmean( df = feature, feat= 'loan_term', label = 'bad_ind', nbins = 3)
[Package autoScorecard version 0.3.0 Index]