python 随机森林中的OOB

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 随机森林中的OOB相关的知识,希望对你有一定的参考价值。

The out-of-bag (oob) error estimate:

In random forests, there is no need for cross-validation or a separate test set to get an unbiased estimate of the test set error. It is estimated internally, during the run, as follows:

Each tree is constructed using a different bootstrap sample from the original data. About one-third of the cases are left out of the bootstrap sample and not used in the construction of the kth tree.

Put each case left out in the construction of the kth tree down the kth tree to get a classification. In this way, a test set classification is obtained for each case in about one-third of the trees. At the end of the run, take j to be the class that got most of the votes every time case n was oob. The proportion of times that j is not equal to the true class of n averaged over all cases is the oob error estimate. This has proven to be unbiased in many tests.
#put oob score true in random forest definition
print '\nThe OOB score: {0:4.5f}' .format(rf.oob_score_)

以上是关于python 随机森林中的OOB的主要内容,如果未能解决你的问题,请参考以下文章

随机森林中oob以及oob的作用?

15、随机森林的OOB

随机森林的oob估计是怎样选取数据的

随机森林的高OOB错误率

sklearn 随机森林:.oob_score_ 太低?

随机森林之oob的计算过程