A Pattern for Every Body Shape

August 19, 2026 · Part 3 of 20

Opening Scene

A tailor doesn’t invent a brand-new cutting approach for every single customer. Over years of work, the shop has built a set of standard patterns for common body shapes and preferences, and each new customer gets matched to the pattern that fits closest, then adjusted from there. The pattern itself is a category — “athletic fit,” “relaxed fit,” “tailored fit” — and the shop has a consistent, repeatable way of translating that category into an actual cutting guide.

That translation — turning a category into something concrete and usable — is exactly what encoding categorical variables does for a model, which can’t work with words like “athletic” directly any more than scissors can work with the word “fit.”

In Plain English

Categorical variables are fields that represent a category rather than a number — a color, a country, a product type, a body-shape label. Models generally can’t use raw category labels as-is; they need those categories translated into a numeric form first, a process called encoding. Different encoding choices — assigning each category its own column, ranking categories in order, or something more sophisticated — carry different assumptions about the categories’ relationships to each other, and picking the wrong one can quietly mislead a model about what those categories actually mean.

The Old Way

Before “encoding” had a formal name in machine learning, translating categories into something usable was a familiar, informal skill:

  • A tailor’s numbered pattern system, translating a fuzzy customer preference into a specific, reusable cutting guide.
  • A librarian’s classification system, translating a book’s subject into a specific, sortable shelf location.
  • A store’s SKU system, translating a product’s category and variant into a specific, trackable code.

Each system existed to make a fuzzy, human category concrete and consistently usable by something more mechanical downstream.

What’s Changing (and Why AI Is the Reason)

  1. Modern encoding techniques can handle categories with far more distinct values than older approaches could practically manage — a category with thousands of possible values, once genuinely difficult to encode well, now has workable, well-understood approaches.
  2. Some AI models can learn their own useful numeric representation of a category directly from data, similar in spirit to the embeddings covered in Article 15, reducing how much manual encoding decision-making is required upfront.
  3. AI tooling can increasingly suggest which encoding approach fits a given categorical variable best, based on how many distinct values it has and how it relates to the target, rather than leaving that choice purely to practitioner intuition.

The Metaphor, Fully Extended

Tailor ShopCategorical Encoding Concept
A customer’s stated preference: “athletic fit”A raw categorical value
The shop’s standard pattern libraryThe full set of possible categories
Matching a preference to a specific numbered patternEncoding a category into a usable, numeric form
Treating “athletic” and “relaxed” as unrelated optionsOne-hot encoding — no assumed order between categories
Ranking fits from “loosest” to “tightest”Ordinal encoding — categories with a meaningful order
A pattern library with too many near-identical entriesA high-cardinality categorical variable, harder to encode cleanly

For Beginners: What to Actually Do

  • Before encoding a categorical variable, ask whether its categories have a natural order or not — that answer determines which encoding approach actually makes sense.
  • Get comfortable with the basic encoding options and what assumption each one makes about the relationship between categories.
  • Watch for categorical fields with an unexpectedly large number of distinct values — they often need a different approach than a simple, small category set.

For Practitioners and Leaders: The Deeper Layer

  • Encoding choice isn’t a minor technical detail — a poorly chosen encoding can introduce a false sense of order or distance between categories that misleads the model in subtle, hard-to-detect ways.
  • High-cardinality categorical variables deserve deliberate strategy, not a default one-hot encoding applied blindly, which can bloat a dataset and dilute a model’s ability to learn from any single category.
  • Revisit encoding choices when a categorical variable’s real-world set of values changes — a new product category or new region added later needs to be handled consistently with how prior categories were encoded.

Quick Recap

  • Categorical variables represent categories, not numbers, and need to be encoded into a numeric form before most models can use them.
  • This mirrors familiar systems like pattern libraries and classification schemes — translating a fuzzy category into something concrete and usable.
  • Different encoding approaches carry different assumptions about how categories relate to each other, and choosing wrong can mislead a model.
  • High-cardinality categories, with many distinct values, need deliberate strategy rather than a one-size-fits-all default.

Where This Fits in the Series

Article 2 covered understanding raw data before transforming it; this article covered the specific, common transformation of encoding categories. Article 4 looks at a different transformation entirely — adjusting the scale of numeric data itself.