For the sake of my own exploration, I am working on a sales prediction project. I am using text extracted from a set of books to build a predictive model.

With scikit learn, I have created a Tfidf, and together with the numeric sales numbers, I created a SGDRegressor. But I'd like to practice with other models.

I am looking over the options available to me, and I'm wondering, what other algorithms might be useful in this kind of regression scenario? And/or, what other algorithms in scikit learn will take a tfidf as the dataset?

  • $\begingroup$ You can try RandomForestRegressor $\endgroup$ – Sergey Bushmanov Jan 19 '16 at 6:28
  • $\begingroup$ Welcome to the site :) $\endgroup$ – Dawny33 Jan 19 '16 at 6:33

In sklearn Anything that will take sparse data can take output from TFIDF.

In sklearn basically all data any model can take is either dense (normal array) or sparse (that only stores the location of values != 0). You can convert from sparse to dense, but chances are you'll run out of memory if you try.

I'm quite a big fan of using linear algorithms on text data (sgdregressor for example have a ton of different options you can play with). But other algorithms like randomforest that Sergey mentioned, and naive bayes models can also work with that kind of data. Basically what you are looking for is anything that can take sparse input data.

(One thing I've done in the past when working with text+other data is taking output from an sgd's analysis of the data and feeding that + the other data to another algorithm like randomforest. It's a simple and quite powerful method)


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.