What is bag of words? How we can use it for text classification?
NLPLevel: IntermediateText classification
What is bag of words? How we can use it for text classification?
Hints
- Separate text representation, modeling and evaluation.
- Check ambiguity, rare terms and training versus target text distributions.
Answer
Bag of Words is a representation of text that describes the occurrence of words within a document. The order or structure of the words is not considered. For text classification, we look at the histogram of the words within the text and consider each word count as a feature.
Source and licence: Alexey Grigorev & contributors — Data Science Interviews · CC-BY-4.0