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 Answer
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/