R中的随机森林

时间:2014-01-14 02:46:43

标签: r tree random-forest

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

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

x[[9]]是什么意思?

1 个答案:

答案 0 :(得分: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"

如果按x[[9]]表示第9个广告位,那么predict_weights?'RandomForest-class'告诉我们这是

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