I have a text classification task. These are the metrics for different languages at present:

class1: 0.6823
class2: 0.7450
class3: 0.66
class4: 0.6719

How can I increase the performance of my random forest classifier in order to reach 90% accuracy? I already tried increasing the number of estimators and playing with the hyper-parameters that scikit provides, but I cannot significantly increase its performance. What hyper-parameter do I configure in order to increase its performance?

This is my current setup:

# For tfidf: 
tfidf_vect = TfidfVectorizer(norm=u'l1', use_idf=True, smooth_idf=True, 
                             sublinear_tf=False, min_df=2, stop_words=set(my_stop_words))

# For RF:
rbf = RandomForestClassifier(n_estimators=10000, criterion='entropy', max_depth=10000, 
                             max_leaf_nodes=None, bootstrap=True, oob_score=False, 
                             n_jobs=1, random_state=None, verbose=0, min_density=None, 

What about using adaboost + random forest classifier in order to increase the performance? Is that possible?

  • $\begingroup$ A max depth of 10000 seems very large $\endgroup$ – Aaron Apr 21 '15 at 17:25
  • $\begingroup$ What makes 90% accuracy a magic number? That level of accuracy is likely seriously over-fit to the training data. $\endgroup$ – Matthew Drury Aug 19 '15 at 15:02
  • $\begingroup$ How did you settle on RF as your model of choice? Another algorithm likely wouldn't improve your results up to 90%, but you could see a few percentage points improvement. $\endgroup$ – Tchotchke Aug 19 '15 at 17:09

Since you're using scikit-learn, and you're trying to tweak the parameters of your classifier, you should consider using GridSearchCV. GridSearchCV allows to try out various parameter setups and pick the best one.

I really doubt this will let you achieve 90% accuracy, though. You should rather rethink whether the dataset you're using, and your feature extraction routines are sufficient to aim at such an accuracy level.


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.