Data Mining · CSC213

Binning: Equal-Width vs Equal-Frequency (Equal-Depth) with Examples

Data Mining Study guides

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.

  1. Divides the range into N intervals, each containing approximately same number of samples is Equal-depth (frequency) partitioning?
    • A. False
    • B. True
  2. Sort the dataset and partition into equal frequency. This process called
    • A. Classification
    • B. Regression
    • C. Clustering
    • D. Binning
  3. Divides the range into N intervals of equal size is Equal-width (distance) partitioning?
    • A. True
    • B. False