Discretize numeric variable by maximizing the gain ratio between each bucket and the target variable.

discretize_rgr(input, target, min_perc_bins = 0.1, max_n_bins = 5)

Arguments

input

numeric input vector to discretize

target

character or factor multi-calss target variable

min_perc_bins

minimum percetange of rows for each split or segment (controls the sample size), 0,1 (or 10 percent) as default

max_n_bins

maximum number of bins or segments to split the input variable, 5 bins as default

Value

discretized variable (factor)

Examples

if (FALSE) { library(funModeling) data=heart_disease input=data$oldpeak target=as.character(data$has_heart_disease) input2=discretize_rgr(input, target) # checking: summary(input2) }