If x
is a Random Forest in R, for example,
x <- cforest (y~ a+b+c, data = football),
what does x[[9]]
mean?
You can't subset this object, so in some sense, x[[9]]
is nothing, it is not accessible as such.
x
is an object of S4 class "RandomForest-class"
. This class is documented on help page ?'RandomForest-class'
. The slots of this object are named and described there. You can also get the slot names via slotNames()
library("party")
foo <- cforest(ME ~ ., data = mammoexp, control = cforest_unbiased(ntree = 50))
> slotNames(foo)
[1] "ensemble" "where" "weights"
[4] "initweights" "data" "responses"
[7] "cond_distr_response" "predict_response" "prediction_weights"
[10] "get_where" "update"
If by x[[9]]
you meant the 9th slot, then that is predict_weights
and ?'RandomForest-class'
tells us that this is
‘prediction_weights’: a function for extracting weights from
terminal nodes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.