0
$\begingroup$

I'm attempting to classify text documents using a few different dimensions. I'm trying to create arbitrary topics to classify such as size and relevance, which are linear or gradual in nature. For example:

size: tiny, small, medium, large, huge. relevance: bad, ok, good, excellent, awesome

I am training the classifier by hand. For example, this document represents a 'small' thing, this other document is discussing a 'large' thing. When I try multi-label or multi-class SVM for this it does not work well and it also logically doesn't make sense.

Which model should I use that would help me predict this linear type of data? I use scikit-learn presently with a tfidf vector of the words.

$\endgroup$
  • $\begingroup$ maybe I just need to add another vector in addition to the words...? but that seems odd. $\endgroup$ – dwenaus Sep 17 '15 at 18:31
1
$\begingroup$

If you want these output dimensions to be continuous, simply convert your size and relevance metrics to real-valued targets. Then you can perform regression instead of classification, using any of a variety of models. You could even attempt to train a multi target neural net to predict all of these outputs at once.

Additionally, you might consider first using a topic model such as LDA as your feature space.

Based on the values, it sounds like the "relevance" might be a variable best captured by techniques from sentiment analysis.

$\endgroup$
  • $\begingroup$ can you give examples of how one would perform regression on a bag of words? $\endgroup$ – dwenaus Sep 17 '15 at 19:25
  • 1
    $\begingroup$ If you used LDA for example, each document would be represented by a topic vector. You could then transform your labels ("big", "small", etc) into real-values (big=100,small=10,tiny=1) and perform any kind of regression, even simple linear regression, to predict the real-valued targets. There are a number of places you could get implementations of LDA. What language are you using? $\endgroup$ – jamesmf Sep 17 '15 at 19:29
  • $\begingroup$ We're using python and scikit-learn. I've used LDA and LSA for topic modelling, but I'm not sure how that fits onto my labels. And what about just using a tfidf vector of the document words? $\endgroup$ – dwenaus Sep 17 '15 at 19:58
  • 1
    $\begingroup$ Sure, tf-idf vectors might be sufficient. If you need your output labels to be ordered, you need to either assign real values to the targets (as I said above). In order to go from tf-idf vectors or topic vectors to your labels, you would either use any kind of regression (if you map labels to numbers) or a classifier (which it sounds like you've already tried). $\endgroup$ – jamesmf Sep 17 '15 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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