A bag-of-words model turns text into machine-learning features by recording which words appear or how often they appear, while ignoring their order. It offers a straightforward starting point for sequential data, but its simplicity removes information that may matter to the prediction task. section 11.1.2
Use the representation with these tradeoffs in mind:
- Choose it when a simple text representation is sufficient for the downstream machine-learning algorithm. section 11.1.2
- Expect word-order information to disappear; longer N-grams can partially recover local sequence information compared with single-word unigrams. section 11.1.2
- Compare it with TF-IDF, BM25, or pretrained language-model representations such as BERT when the task needs a different text encoding. section 11.1.2




