Loading slide

The Representation Problem

  1. 01The Representation Problem
  2. 02The gap between pixels and words
  3. 03How a lesson spreads
  4. 04Why the numbers have to mean something
  5. 05Go on, try it
  6. 06So add a direction
  7. 07One-hot encoding
  8. 08The question that breaks it
  9. 09What we actually need
  10. 10You already do this
  11. 11Meaning is relational
  12. 12Reinforce your understanding
  13. 13Question: Why labels fail
  14. 14Question: Meaning from company
  15. 15Question: What good numbers do
  16. 16Quiz: answer
  17. 17What to carry out of this chapter
  18. 18Want to go deeper?
7 / 17
BackNext

One-hot encoding

We just saw that a single number is far too cramped: one direction, when meaning needs hundreds. The first real attempt to escape that, years ago, went all the way to the opposite extreme. It gave each word a huge pile of numbers instead of one. It did fix the cramping, but it fixed it so bluntly that it threw out the very thing we wanted. It is worth seeing exactly how, because its failure points straight at what a good answer has to do.

The scheme is called , and the easiest way to picture it is a long row of light switches. Imagine one switch for every word in the language, ten thousand switches lined up in a row. To represent a single word, you flip on exactly one switch, the one that belongs to that word, and leave all the other 9,999 switched off.

Written as numbers, an on switch is a 1 and an off switch is a 0. So each word becomes a row of ten thousand numbers that are all 0 except for a single 1. "Dog" is the row with the 1 sitting in slot 2,742 and 0 everywhere else. "Puppy" is the row with its 1 in slot 6,015. Every word gets its own private switch, and no two words ever share one.

Now see what this was designed to buy us. The thing that ruined the single-number street was accidental closeness: "dog" and "dollar" ending up next-door neighbours for no reason, so lessons spread between them. One-hot makes that impossible. No two words sit next to each other, because no two words share any switch at all. Each word is off in its own slot, touching nothing. There are no accidental neighbours, because, as we're about to see, there are no neighbours of any kind.

And that is the catch hiding in plain sight. At first glance one-hot looks like it finally solved the problem: no lies, no false closeness, every word clearly distinct. Hold that thought for one slide. We're going to ask a single simple question about these switch-rows, and the whole thing comes apart.

Citations(2)↓
  1. 1. cs.brown.edu
  2. 2. ibm.com
Citations(2)↓
  1. 1. cs.brown.edu
  2. 2. ibm.com