I have a collection of statements which I need to classify into 5 classes. Each statement have meta data in different columns:

Author|Editor| date of release| statement | Class

How can one use the meta data to improve the text classification task?


Some models cannot really handle this, while others lend themselves for it easily. I'll explain two approaches that you could use:

Naive bayes

With Naive Bayes you can use other categorical values as well as your normal n-grams or sparse bag of words vectors. Just add them one-hot encoded to your features and it is also incorporated. With numerical features you would need to use something like Gaussian Naive Bayes, to fit a distribution to your features per target class, then you can use the likelihoods of these features per class to compute the probabilities.

Neural network

If you use a neural network approach like CNNs or RNNs, you can add any type of feature representation network and concatenate it somewhere in your original network. In your case you would have a softmax at the end of your RNN. Before this, concatenate the output of your 'normal-feature' neural network, add some dense layers and feed this to your softmax output layer. This way you can train your model end-to-end and it will learn important interactions as well.

| improve this answer | |
  • $\begingroup$ Can you provide sources about neural networks handling this case? $\endgroup$ – ChiPlusPlus Dec 1 '17 at 6:39
  • 1
    $\begingroup$ This is just my personal experience, concatinating different models together is pretty common and one of the big benefits of neural networks. Look for multimodal input, there should be plenty of papers using similar ideas. $\endgroup$ – Jan van der Vegt Dec 1 '17 at 7:07

Not the answer you're looking for? Browse other questions tagged or ask your own question.