# Threshold Value for Random Forest Classifier

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

• Your question is too broad. In any case, I recommend you to check this link – Ripstein Apr 9 '18 at 14:20

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:

estimator.tree_.max_depth


I suggest you to perform GridSearch on max_depth:

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


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/