Skip to content
Machine Learning

Explain what bucketing is.

Converting a (usually continuous) feature into multiple binary features called buckets or bins, typically based on value range.

datasciencetrivia.com

Card 1 of 259. Answer: Converting a (usually continuous) feature into multiple binary features called buckets or bins, typically based on value range.

Created by santiviquez

About · Quizzes · History of AI · To suggest new questions or report an error send me a dm.

The longer answer

Bucketing, also called binning or discretization, turns a continuous feature into a categorical one by splitting its range into intervals called buckets or bins. Each value is then represented by its bucket, usually as one binary feature per bucket.

Example: with age buckets of under 18, 18 to 34, 35 to 54, and 55 and over, a 40-year-old is encoded as 0, 0, 1, 0. Boundaries can be equal-width, or quantile-based so that each bucket holds the same number of rows, which suits skewed data like income. A linear model then gets one weight per bucket and can learn a non-linear effect, such as risk that is high for the young and the old.

The cost is lost information: 35 and 54 look identical, while 34 and 35 look entirely different. Interviewers may ask how to choose boundaries (on training data only) and whether trees need bucketing (they don't; they pick split points themselves). Don't confuse it with Hive or Spark bucketing, which hash-partitions rows to speed up joins.

All questions