What happens to new words that appear in Test dataset but are not present in Training Data?

Similar to other preprocessing techniques, it is considered best practice to fit the vectorizer on the train dataset and then transform the test dataset using the parameters learned from only the training data. If a word appears in the test dataset that was not seen when the vectorizer was fit to the training data, it will essentially be ignored, as it was not part of the vocabulary learned by the vectorizer. One work around to this issue is to create a rule that assigns the rarest tokens to an umbrella word that encompasses all such words in the vocabulary, sort of like creating an “Other” category when performing binning or discretization. Ultimately, it is desired to perform a train/test split in such a manner so this does not occur.

Author

Help us improve this post by suggesting in comments below:

– modifications to the text, and infographics
– video resources that offer clear explanations for this question
– code snippets and case studies relevant to this concept
– online blogs, and research publications that are a “must read” on this topic

Leave the first comment

Partner Ad
Find out all the ways that you can
Contribute