AI engineering glossary · Feature engineering data prep

What is bag of words?

Bag of words (also called BoW): A text representation that describes a document by how many times each vocabulary word appears, ignoring word order and grammar. It is simple and effective for classification but creates large, sparse vectors and loses context.

Level: beginnerTopic: Feature engineering data prep

Bag of words: an example

With vocabulary [good, bad, movie], the review 'good good movie' becomes [2, 0, 1].

Related terms

More Feature engineering data prep terms

Where you learn it

Bag of words is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.