随机森林(rfsrc软件包):多变量分析

时间:2018-11-20 19:29:17

标签: r random-forest

我正在尝试评估子产品促销之间的互动。 我的数据集统计了1073个二元变量(x)和11个依存变量(y)。我在R中使用rfsrc包。

fit2=rfsrc(Multivar(y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11) ~.,data = data3, importance =TRUE)
err <- get.mv.error(fit2)
err
vmp.std <- get.mv.vimp(fit2, standardize = TRUE)
plot(fit2)

为什么默认情况下,R只给我y1作为回应?

                         Sample size: 602
                     Number of trees: 1000
           Forest terminal node size: 5
       Average no. of terminal nodes: 179.484
No. of variables tried at each split: 358
              Total no. of variables: 1073
              Total no. of responses: 11
         User has requested response: y1
       Resampling used to grow trees: swr
    Resample size used to grow trees: 602
                            Analysis: mRF-R
                              Family: regr+
                      Splitting rule: mv.mse *random*
       Number of random split points: 10
                % variance explained: 53.03
                          Error rate: 0.4

有一些命令可以绘制一些信息吗?

1 个答案:

答案 0 :(得分:0)

如果您查看调用plot.variable.rfsrc.R的源代码以绘制您的randomForestSRC对象,则m.target的默认值为NULL并将其馈送到另一个函数{{3} },它将采用第一个变量。如果要绘制其他变量,请指定m.target=...

library(mlr)
library(randomForestSRC)

yeast = getTaskData(yeast.task)
data = yeast[,c(1:3,15:100)]
head(data)
fit = rfsrc(Multivar(label1,label2,label3) ~.,data = data, importance =TRUE)

plot(fit,m.target="label2")

get.univariate.target

plot(fit,m.target="label3")

enter image description here