liveBook · Manning

Cardinality

As explained in Ensemble Methods for Machine Learning

Cardinality is the number of unique categories or values represented by a categorical feature.

Cardinality counts the unique categories represented by a categorical feature. It guides encoding choices: many categories can make one-hot encoding unwieldy, while ordinal encoding may impose an unjustified order. section 8.4

Employee job titles

An employee dataset contains 385 employee-position titles, compared with two genders and 37 departments. The job-title feature is therefore high-cardinality; spelling errors and alternate titles can increase its apparent cardinality further. section 8.4

High-cardinality string features often require similarity-based encoding, which groups categories with similar wording rather than matching only exact strings. SimilarityEncoder, MinHashEncoder, and GapEncoder provide alternative treatments. section 8.4

How Ensemble Methods for Machine Learning covers it

How deep it goes
Defines unique-category counting and connects it to encoding tradeoffs, but stops short of formal analysis.
Examples
Uses employee job titles, category-count diagnostics, spelling variants, and alternate titles as concrete examples.
What it assumes
Assumes categorical features and distinguishes exact category matching from similarity-based grouping.
What you can do after
Apply it via category-count diagnostics and choose encoders such as SimilarityEncoder, MinHashEncoder, or GapEncoder.
How it connects
Connects categorical features with one-hot encoding, ordinal encoding, string similarity, and similarity-based encoding.

Also explained in

Compare how 8 books explain cardinality →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Ensemble Methods for Machine Learning. The section links point to the parts of the book it draws on.