Study Vault Search notes, aliases and full text
Graph
ConceptDBISAI-written · not yet proofread

One-Hot Encoding

Given an ordered vocabulary V, the one-hot encoding of a word is the vector in {0,1}^|V| that is 1 at the word's index and 0 everywhere else.

Properties#

  • Pairwise orthogonal: ei⋅ej=0e_i \cdot e_j = 0 for i≠ji \neq j, hence cos-sim(ei,ej)=0\text{cos-sim}(e_i, e_j) = 0 (Cosine Similarity).
  • Documents and queries are sums: a document column of the term-document matrix in the Vector Space Model (VSM) is the sum of the one-hot encodings of its words, with multiplicity: d=∑w∈docewd = \sum_{w \in \text{doc}} e_w (with tf entries). A query vector is the same sum; since a query typically contains few keywords, each at most once, it has a few 1s and 0s otherwise.
  • Dimension ∣V∣|V|: very large for real vocabularies, and the vectors are maximally sparse (one nonzero entry).
  • No semantics: “internet” and “web” are exactly as (dis)similar as “internet” and “beach” (cos-sim 00 in both cases). This motivates word embeddings: dense, low-dimensional vectors in which related words have high cos-sim.

Example#

Sources#

Search

Type In
↑ ↓ move ↵ open ⇥ next section Ctrl↵ results page Prefix # to search text only