theNotebook

Shelf one · How a machine learns

Features & Encoding

Intermediate · 1 min read · Three tellings

Kitchen table

Computers only understand numbers, so everything else has to be turned into numbers first. 'Math', 'Science' and 'Art' cannot go in as words, but if you call them 1, 2 and 3, the computer thinks Art is somehow three times Math, which is nonsense. So instead you give each subject its own switch: Art is 'off, off, on'. A lot of the real work in machine learning is exactly this – turning messy real-world stuff into numbers without accidentally lying.

Whiteboard

One-hot, ordinal, target and hashing encoders. Embeddings when the vocabulary explodes. Multi-label columns that refuse to be tidy. And leakage, the silent killer, where information from the future or the label sneaks into a feature and the model aces validation while learning nothing. Feature work still beats model choice more often than anyone at a conference will admit. The unglamorous questions – what was known at prediction time, what is stable across seasons – are the ones that decide whether the thing survives production.

Boardroom

Most of the effort in a real AI project is not the model. It is getting messy business data into a shape a model can use, and that ratio has stayed stubbornly around four-to-one for a decade. When a project slips, this is usually where it slipped. It is also where institutional knowledge lives: the analyst who knows that the 'region' field changed meaning in 2021 is worth more to the project than another data scientist. Fund the plumbing and keep the people who understand the data's history.

“Art”0Math0Science1Artits own switch –no fake orderingmost of the real work happens right here
Words become switches, without pretending Art is bigger than Math.

Keywords

  • feature engineering
  • one-hot encoding
  • categorical variables
  • ordinal encoding
  • multi-label
  • preprocessing

Search the notebook