I am just curious about how Random forest calculates the (Out-of-bag) OOB error rate.

In my course note, it says that RF will predict each observation using only trees in which that observation does not appear. It makes sense but what if a observation appears in all the tree, how can we calculate OOB error rate for this observation?

Really appreciate any help


1 Answer 1


The simple answer is, if you do not have any bootstrap datasets that do not include an observation, then that observation cannot be used to calculate the OOB error rate because you don't have any out of bag information for that observation.

But consider this question: Why on average does each bootstrap sample contain roughly two thirds of observations?

There are some excellent answers there as to why, but suffice to say that the probability of any observation being selected in any one bootstrap dataset is $\sim \frac{2}{3}$. Actually it approaches $1 - \frac{1}{e}$ for large datasets.

In random forest simulation, you typically have at least 500 trees. What is the probability that one observation will be selected for each and every one of those trees?

$\left( \frac{2}{3}\right) ^ {500} = 9\mathrm{e}{-89}$


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.