Extract a subset of tree from random forest model for prediction

风流意气都作罢 提交于 2019-12-11 09:33:48

问题


From Liaw's classification and regression by RF paper, "The best way to determine how many trees are necessary is to compare predictions made by a forest to predictions made by a subset of forest"

I am wondering if there is a way to extract subtree for prediction with R's randomForest package. getTree seems to print out the structure. Any suggestion would be greatly appreciated.


回答1:


Try this one in randomForest, predict(rf, dat, predict.all=TRUE), you can get predictions from all the sub trees.



来源:https://stackoverflow.com/questions/21567893/extract-a-subset-of-tree-from-random-forest-model-for-prediction

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!