weighted combination of various words by setting the threshold and choosing the words that are more meaningfulwe can build histogram of all the words in the documents that can be used as feature vector following is an example to understand the concept of document term matrixexample suppose we have the following two sentencessentence we are using the bag of words model sentence bag of words model is used for extracting the features nowby considering these two sentenceswe have the following distinct wordswe are using the bag of words model is used for extracting features nowwe need to build histogram for each sentence by using the word count in each sentencesentence [ , , , , , , , , , , , , sentence [ , , , , , , , , , , , , in this waywe have the feature vectors that have been extracted each feature vector is -dimensional because we have distinct words concept of the statistics the concept of the statistics is called termfrequency-inverse document frequency (tfidfevery word is important in the document the statistics help us nderstand the importance of every word term frequency(tfit is the measure of how frequently each word appears in document it can be obtained by dividing the count of each word by the total number of words in given document