我在和
ranger
,一个随机森林的快速实现。问题是我不知道如何解释
$forest
结果的组成部分。文件只是说
forest
:保存的林(如果
write.forest
TRUE
). 注意,中的变量id
split.varIDs
对象不一定
表示R中的列号。
好吧,那不是真的有帮助,所以我试着自己检查它的组件,它们的名字并不是不言自明的。
> names(ranger(Species ~ ., data = iris)$forest)
[1] "dependent.varID" "num.trees"
[3] "child.nodeIDs" "split.varIDs"
[5] "split.values" "is.ordered"
[7] "class.values" "levels"
[9] "independent.variable.names" "treetype"
一些组件如
num.trees
很难理解,但是
child.nodeIDs
真是令人心旷神怡。
> ranger(Species ~ ., data = iris)$forest$child.nodeIDs[[1]]
[[1]]
[1] 1 3 5 0 7 9 11 0 0 0 13 15 0 0 0 0 0
[[2]]
[1] 2 4 6 0 8 10 12 0 0 0 14 16 0 0 0 0 0
有记录吗?