Bag-of-words

Also: BoW, bag of words

A sparse, count-based text representation: each dimension is one vocabulary word and its value is how often that word occurs in the document (or a binary or TF-IDF weight). Simple and interpretable, but "not good" and "good not" get the same vector.

Example

"The cat sat on the mat" over the vocabulary [the, cat, sat, on, mat, dog] becomes [2, 1, 1, 1, 1, 0]: "the" appears twice, "dog" not at all.

See it in the lesson: Bag-of-Words →

Related terms

More in Language & LLMs