Vector Space Model & TF-IDF (1968) › Representing Documents Geometrically
History of Language AIAll chapters Vector Space Model & TF-IDF (1968) › Representing Documents GeometricallyOne section · Sections in this chapter3 / 12 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
In this model, each document is a point in a high-dimensional vector space. Every dimension represents a term in the collection vocabulary, and a document's coordinates depend on the terms it contains and their assigned weights.
More precisely, a document vector is an ordered list of term weights. A vocabulary of 10,000 terms produces 10,000 dimensions. Most coordinates are zero because a document uses only a fraction of the vocabulary, so the representation is sparse.
Documents with similar weighted vocabularies point in similar directions. Cosine similarity measures the cosine of the angle between two vectors: a smaller angle gives a higher score, while vectors with little overlap approach orthogonality.
The cosine similarity between two vectors and is computed as:
The numerator is the dot product of the vectors, and the denominator normalizes by their magnitudes. With nonnegative TF-IDF weights, the result ranges from 0 to 1. A value of 1 indicates the same direction, while 0 indicates orthogonal vectors with no weighted-term overlap.
Because cosine similarity compares direction rather than magnitude, a long document and a short one can receive a high score when their term-weight distributions are similar.
Queries use the same vector representation as documents. Retrieval computes the similarity between a query vector and each candidate document vector, then ranks the documents by score.
The remaining question was how to assign each term weight.