From a protocol to count vectors
Corpora and evaluation fixed the fitting and measurement boundaries. We can now inspect a complete count-based representation inside those boundaries.
Four equipment-desk messages are enough to build a complete text representation by hand. We can count their words, rank them for a query, and fit a small classifier. The same calculation also reveals exactly what this representation cannot distinguish.
Baseline: counting tokens
Fix a vocabulary with entries and an order for those entries. For document , let be the number of occurrences of vocabulary token . The vector is a bag-of-words representation: it retains multiplicities and discards order. The word bag distinguishes counts from a set, which records presence only.
The vocabulary is fitted on permitted training text. At prediction time, its order remains fixed. A token absent from the vocabulary contributes no coordinate under the simple policy used here. A document containing only unknown tokens therefore becomes a zero vector. Record this case rather than pretending that zero means an ordinary average document.
Our complete constructed collection is:
| Document | Text |
|---|---|
| 1 | desk lamp lamp pickup |
| 2 | desk lamp return |
| 3 | desk tripod return |
| 4 | desk tripod tripod pickup |
We use whitespace tokens and the vocabulary order desk, lamp, pickup, return, tripod. The count matrix is
Rows are documents and columns are vocabulary entries. Twelve of the twenty cells are nonzero. Larger vocabularies often make each document sparse because one document contains only a subset of all possible tokens. Sparse storage records the occupied coordinates rather than allocating every zero. Its benefit depends on the number of nonzeros and indexing overhead; a tiny dense matrix like ours does not demonstrate a storage benchmark.