Term frequency–inverse document frequency (TF-IDF) converts text into features that machine-learning algorithms can process, weighting terms by their document frequency and broader corpus frequency. section 11.1.2
Use TF-IDF with these practical cautions:
- Treat it as a sequential-data representation alongside bag-of-words and BM25. section 11.1.2
- Expect it to lose word-order information; use longer N-grams to partially recover that signal. section 11.1.2
- Consider pretrained language models such as BERT when a low-dimensional embedding representation is more suitable. section 11.1.2
Text feature generation
Represent text with TF-IDF before feeding it to an ML algorithm, while recognizing that the resulting features do not preserve word order. section 11.1.2









