Binning: Equal-Width vs Equal-Frequency (Equal-Depth) with Examples
Binning splits sorted numeric values into bins. Equal-width bins have the same range; equal-frequency (equal-depth) bins hold approximately the same number of values.
Equal-width (distance) partitioning divides the range into N intervals of equal size, with width = (max - min) / N. It is simple, but skewed data and outliers can leave some bins nearly empty and others crowded. Equal-frequency (equal-depth) partitioning sorts the data and divides it into N bins, each containing approximately the same number of samples. It handles skewed data better, though bin boundaries can be uneven.
After binning you can smooth the noisy values: smoothing by bin means replaces each value with its bin mean, smoothing by bin medians uses the median, and smoothing by bin boundaries replaces each value with the closest boundary (min or max of the bin).
Binning is also used to discretize a continuous attribute into intervals and so reduce the number of values.
Key points
- Equal-width: width = (max - min) / N.
- Equal-frequency: same count per bin after sorting.
- Smoothing by means, medians or boundaries.
- Outliers distort equal-width bins.
- Binning discretizes and smooths noisy data.
Worked example
Sorted prices: 4, 8, 9, 15, 21, 21, 24, 25, 26, 28, 29, 34. Equal-frequency with 3 bins: [4, 8, 9, 15], [21, 21, 24, 25], [26, 28, 29, 34]. Bin means are 9, 22.75 and 29.25. Equal-width with 3 bins: width = (34 - 4) / 3 = 10, giving [4-14): 4, 8, 9; [14-24): 15, 21, 21; [24-34]: 24, 25, 26, 28, 29, 34.
Common questions
Which binning handles skewed data better?
Equal-frequency, because each bin gets about the same number of values.
How do you compute equal-width bin size?
Subtract the minimum from the maximum and divide by the number of bins.
Practice questions on this topic
Try these, then open the app to check your answers with explanations.
- Divides the range into N intervals, each containing approximately same number of samples is Equal-depth (frequency) partitioning?
- A. False
- B. True
- Sort the dataset and partition into equal frequency. This process called
- A. Classification
- B. Regression
- C. Clustering
- D. Binning
- Divides the range into N intervals of equal size is Equal-width (distance) partitioning?
- A. True
- B. False
Related topics
- Data Cleaning: Noise, Outliers, Missing Values and Inconsistent Data
- Data Normalization: Min-Max, Z-Score and Decimal Scaling with Examples
- Quartiles, IQR and the 1.5 x IQR Outlier Rule
- Data Reduction: Sampling, Aggregation, Dimensionality Reduction and Compression
- What is Data Mining? Tasks: Classification, Clustering, Regression, Association Rules
- The KDD Process: Knowledge Discovery in Databases Steps
- All topics: Data Mining
BASMAGLY is an independent student project, not an official Delta University site. Check lectures and your instructor for the final word.