R中的随机森林

1 tree r random-forest

x例如,如果是R中的随机森林,

x <- cforest (y~ a+b+c, data = football),
Run Code Online (Sandbox Code Playgroud)

什么x[[9]]意思?

Rei*_*son 5

您无法对此对象进行子集化,因此在某种意义上x[[9]],它不是任何东西,因此无法访问它.

x是S4类的对象"RandomForest-class".该类记录在帮助页面上?'RandomForest-class'.该对象的槽在那里被命名和描述.您还可以通过获取插槽名称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"
Run Code Online (Sandbox Code Playgroud)

如果x[[9]]你的意思是第九插槽,然后就是predict_weights?'RandomForest-class'告诉我们,这是

 ‘prediction_weights’: a function for extracting weights from
      terminal nodes.
Run Code Online (Sandbox Code Playgroud)