简体   繁体   English

R中的随机森林

[英]Random Forest in R

If x is a Random Forest in R, for example, 例如,如果x是R中的随机森林,

x <- cforest (y~ a+b+c, data = football),

what does x[[9]] mean? x[[9]]是什么意思?

You can't subset this object, so in some sense, x[[9]] is nothing, it is not accessible as such. 您无法对该对象进行子集化,因此从某种意义上讲, x[[9]]无效,因此无法访问。

x is an object of S4 class "RandomForest-class" . x是S4类"RandomForest-class" This class is documented on help page ?'RandomForest-class' . 此类记录在帮助页面?'RandomForest-class' The slots of this object are named and described there. 在此命名和描述该对象的插槽。 You can also get the slot names via slotNames() 您还可以通过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 如果用x[[9]]表示第9个时隙,则这是predict_weights?'RandomForest-class'告诉我们这是

 ‘prediction_weights’: a function for extracting weights from
      terminal nodes.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM