equalfrequency
Equalfrequency, also called equal-frequency binning or quantile discretization, is a method for converting a continuous variable into a categorical variable by dividing its values into a predefined number of bins such that each bin contains roughly the same number of observations. Unlike equal-width binning, which splits the value range into intervals of equal size, equalfrequency bins are defined by data-driven thresholds at specific quantiles.
To apply equalfrequency binning, you choose the desired number of bins k. The data are sorted by
Advantages of this approach include robustness to skewed distributions and outliers, and the ability to ensure
Drawbacks include irregular bin widths in the original value scale, which can obscure meaningful thresholds or
Common applications include preprocessing for machine learning models that benefit from categorized inputs, such as logistic