在R randomForest中的公式接口中添加交互

时间:2016-04-26 07:55:05

标签: r random-forest

rf = randomForest(Species ~.^4, data = iris) varImpPlot(rf)

而不是添加的互动varImpPlot仅显示四个变量,它是否真的使用了其他互动?

1 个答案:

答案 0 :(得分:1)

烨。互动条款包含在您的rf中:

attr(rf$terms, "term.labels")

 [1] "Sepal.Length"                                      "Sepal.Width"                                      
 [3] "Petal.Length"                                      "Petal.Width"                                      
 [5] "Sepal.Length:Sepal.Width"                          "Sepal.Length:Petal.Length"                        
 [7] "Sepal.Length:Petal.Width"                          "Sepal.Width:Petal.Length"                         
 [9] "Sepal.Width:Petal.Width"                           "Petal.Length:Petal.Width"                         
[11] "Sepal.Length:Sepal.Width:Petal.Length"             "Sepal.Length:Sepal.Width:Petal.Width"             
[13] "Sepal.Length:Petal.Length:Petal.Width"             "Sepal.Width:Petal.Length:Petal.Width"             
[15] "Sepal.Length:Sepal.Width:Petal.Length:Petal.Width"