Ordinal vs Nominal Categories
What you'll learn: You'll understand the crucial difference between categories with a natural order and those without—a distinction that determines how you should encode them.
The Core Distinction
Not all categorical variables are created equal. Some categories have a natural ordering (ordinal), while others are simply different labels with no inherent sequence (nominal).
Ordinal categories have a meaningful rank or hierarchy. Think of education levels: "High School" < "Bachelor's" < "Master's" < "PhD". The order matters! Similarly, t-shirt sizes (Small, Medium, Large, X-Large) follow a clear progression.
Nominal categories are just names or labels with no intrinsic order. Consider colors (Red, Blue, Green) or countries (USA, France, Japan). There's no logical way to say one is "greater than" another—they're simply different.
Why This Matters for Encoding
This distinction is critical because it determines how you should transform these categories into numbers for machine learning:
- Ordinal data can often be encoded with integers that preserve the order (1, 2, 3, 4...), because the numerical relationship reflects reality
- Nominal data shouldn't use simple integer encoding, because assigning Red=1, Blue=2, Green=3 would falsely suggest Blue is "between" Red and Green
Using the wrong encoding approach can mislead your model into learning false relationships that don't exist in the real world.
Practical Example
- Ordinal: Customer satisfaction ratings (Very Unsatisfied, Unsatisfied, Neutral, Satisfied, Very Satisfied)
- Nominal: Product categories (Electronics, Clothing, Food, Books)
Key Takeaway: Ordinal categories have meaningful order and can be encoded numerically; nominal categories are just labels without order and require different encoding strategies to avoid creating false relationships.