liveBook · Manning

High-cardinality categorical feature

A high-cardinality categorical feature is a categorical feature with many distinct values relative to its dataset or analysis context.

How 2 Manning books explain it

Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

A high-cardinality categorical feature is a categorical feature with many distinct category values relative to the dataset or available computational resources.

How it is used
Guides categorical preprocessing choices before tabular machine-learning pipelines are built.
How deep it goes
Defines cardinality, explains encoding failures, and demonstrates mixed encoding pipelines without specifying a fixed universal threshold.
Examples
Uses Airbnb neighbourhood, room type, and binned geographic coordinates with 221 and 2,259 distinct values.
What you can do after
Apply it via pandas unique-value counts and ColumnTransformer pipelines that assign one-hot, ordinal, or target encoding.

Read how Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI explains high-cardinality categorical feature →

Ensemble Methods for Machine Learning

A high-cardinality categorical feature is a categorical input variable with a large number of distinct categories.

How it is used
Guides encoding choices for categorical inputs whose many values make ordinary representations inefficient or misleading.
How deep it goes
Defines cardinality, explains sparsity and dirty strings, and demonstrates three similarity or hashing encoders in a predictive pipeline.
Examples
Uses ZIP codes, employee job titles, and the Adult data set’s 30-category native-country feature as examples.
What you can do after
Apply dirty_cat encoders in a scikit-learn pipeline and compare held-out regression scores.

Read how Ensemble Methods for Machine Learning explains high-cardinality categorical feature →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.