Index Ai Academy
Glossary · Phase 3 · Machine learning

Bag of words

Representing a document by how often it uses each vocabulary word, ignoring word order.

A model needs numbers, so the first step is to turn each document into a vector. The simplest way is a bag of words: build a vocabulary of every word seen, then represent a document by how many times it uses each one. Word order is thrown away, which sounds drastic but keeps enough to tell a delivery problem from a sizing question.

Try it now

Think about volume, cost per document, and whether the job needs understanding or just keywords.

Learn it properly

Text mining: TF-IDF, search and labels · Bag of words and TF-IDF, similarity search and its blind spots, text classifiers and topics, and when LLM labels are worth it. About 35 minutes.

Create a free account See what's in the lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write