EasyDeepLearn

Ordinal vs nominal encoding — how do you choose?

easy

Answer

  • Ordinal encoding maps categories to integers (0, 1, 2, ...) — makes sense only for ordered categories (education level, star rating), or when passing to a tree-based model that will find splits regardless of numeric order.
  • Never use it for unordered categories with a linear/distance model — the integers imply an ordering that doesn't exist.
  • One-hot encoding is the safe default for unordered (nominal) categoricals with any model; target encoding for high-cardinality categoricals.
Check yourself — multiple choice
  • Always use ordinal encoding for speed
  • Ordinal only for ordered categories or tree models; one-hot for unordered with linear/distance models
  • Both are always equivalent
  • Ordinal encoding is the same as one-hot

Ordinal: only for ordered categories or trees. Otherwise one-hot / target encoding.

#encoding#features#feature-engineering

Practise Supervised Learning

215 interview questions in this topic.

Related questions