concept document in category R

appears as: documents, document, documents, Document
Practical Data Science with R, Second Edition

This is an excerpt from Manning's book Practical Data Science with R, Second Edition.

Suppose you want to train a classifier to distinguish documents about Christianity from documents about atheism.

Figure 6.21. Example of a document and the words that most strongly contributed to its classification as “atheist” by the model

In addition, since the documents in the corpus seem to have included the names of specific posters, this model could also potentially be learning whether a person who posts frequently in the training corpus is a Christian or an atheist, which is not the same as learning if a text is Christian or atheist, especially when trying to apply the model to a document from a different corpus, with different authors.

You might wonder how LIME jitters a text datum. It does so by randomly removing words from the document, and then converting the resulting new text into the appropriate representation for the model. If removing a word tends to change the classification of a document, then that word is probably important to the model.