Is there any way to set a threshold value that can be set for voting results for Random Forest Classifier in sklearn package in order to prevent any misclassification for incoming test data.

  • 1
    $\begingroup$ Your question is too broad. In any case, I recommend you to check this link $\endgroup$
    – Ripstein
    Apr 9, 2018 at 14:20

1 Answer 1


Yes and the most important parameter is the tree depth. It's a pre-pruning technique that allows to prevent overfitting. Specifically for sklearn is:


I suggest you to perform GridSearch on max_depth:

params = {'max_depth':[1,50]}
gs = GridSearchCV(DecisionTreeClassifier(), params)

where X is you training set containing instances and y are the labels.

There are packages that also support post-pruning like this one https://svaante.github.io/decision-tree-id3/


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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