2.2 Features and representations
Features and representations
A model never sees the world directly. It sees the world as you describe it to the model. That description is made of features, and choosing them well is often the difference between a model that works and one that does not.
What a feature is
A feature is a single measurable property of an input. For a house: its size in square feet, its number of bedrooms, its age. For an email: the number of links it contains, whether it came from a known sender, the count of certain words. The collection of features is the representation — the form in which the input is handed to the model.
Representation matters more than you would think
The same underlying object can be represented well or badly, and the model's success depends heavily on which. Predicting whether someone can afford a loan from their raw birth date is awkward; representing it as "age" is far more useful. Detecting a heartbeat problem from a raw audio waveform is hard; representing it as its frequency components can make the pattern obvious. For decades, much of the human effort in machine learning went into feature engineering: hand-crafting good representations.
Learned representations
The deep-learning breakthrough was that neural networks can learn their own features from raw data, instead of relying on humans to engineer them. Given enough images and labels, a deep network discovers useful internal features — edges, then textures, then shapes — without being told to. This is a major theme we return to in week 3: deep models trade hand-crafted features for learned ones, which is why they need so much data and compute.
A worked example
To classify spam, an old-school approach represents each email as a vector of word counts — how many times each word appears — a representation called "bag of words." It throws away word order but captures that "viagra" and "winner" are spam signals. A modern approach feeds the raw text to a model that learns its own richer representation (an embedding) capturing meaning and context. Same email; two representations; very different ceilings on performance.
