Skip to main content
3 of 7
fixed some typos and grammatical errors

Assuming you are doing supervized learning to train a model that when deployed will take text as input and output a label (e.g., topic) or class probability, then what you probably want to do is balanced, stratified sampling. Assuming sufficient labelled data, ensure that your final training set has a balanced number of text examples for each class/label. Depending on your situation, you may need to over/under sample or somehow deal with the problem of highly imbalanced classes (see 8 tactics to combat imbalanced classes).

The simplest NLP approach to use a bag of words technique, simply indicating the presence/absence of a word in the sentence. Thus each sentence becomes represented as vector of length n, where n = the number of unique words in your data set. Sometimes you can increase performance by adding bi-gram and tri-gram features. Sometimes weighting words by their frequency improves performance or computing the tf-idf. Another way to increase performance in my experience, has been custom language feature engineering, especially if the data is from social media sources replete with spelling errors, acronyms, slang, and other word variants. Standard NLP approaches will typically remove stop words (e.g., the, a/an, this/that, etc.) from vector representations are closed class function words often don't help discriminate class boundaries. Because vector representations are typically highly dimensional, dimensionality reductions techniques can increase performance.