discretize_rgr | R Documentation |
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)
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 |
discretized variable (factor)
library(funModeling)
data=heart_disease
input=data$oldpeak
target=as.character(data$has_heart_disease)
input2=discretize_rgr(input, target)
# checking:
summary(input2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.