0
$\begingroup$

I have a question. How is the voting done in random forests. I can't understand rationally, since we have a bootstrap sample drawn, and have built dection trees based on them, where is the new data point taken from to do the voting and extract the results?

$\endgroup$
0
$\begingroup$

Always separate training a model from using the model to make predictions. During training, bootstrap samples are drawn and trees built using those resamples. Voting only occurs when predicting, and all of the trees are used, whether your datapoint is from the original training set or not.

There is a bit of a caveat here though, because we may be interested in the "out-of-bag" scores of the random forest, in which case we want to let the trees that didn't see a given training datapoint vote on the outcome for that datapoint. In that case, we need to keep track of which bootstrapped samples contain which datapoints, and then predict for each using the appropriate subset of trees.

$\endgroup$

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.