Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R randomForest包中的margin()函数不起作用_R_Random Forest_Margins - Fatal编程技术网

R randomForest包中的margin()函数不起作用

R randomForest包中的margin()函数不起作用,r,random-forest,margins,R,Random Forest,Margins,我正在浏览randomForest的软件包文档,看看不同的函数有什么作用。我使用了margin()函数,文档中的示例对我不起作用 我尝试的代码是 library(randomForest) set.seed(1) data(iris) iris.rf <- randomForest(Species ~ ., iris, keep.forest=FALSE) plot(margin(iris.rf)) 库(随机林) 种子(1) 数据(iris) iris.rf我重新开始了我的治疗,一切都恢

我正在浏览randomForest的软件包文档,看看不同的函数有什么作用。我使用了
margin()
函数,文档中的示例对我不起作用

我尝试的代码是

library(randomForest)
set.seed(1)
data(iris)
iris.rf <- randomForest(Species ~ ., iris, keep.forest=FALSE)
plot(margin(iris.rf))
库(随机林)
种子(1)
数据(iris)

iris.rf我重新开始了我的治疗,一切都恢复了正常


我一定是在文档的前面做了某种设置,它解释了随机林的方式。

我重新启动了会话,一切都恢复了正常


我在文档的前面一定有过某种设置,它是如何解释随机森林的。

我自己刚刚开始讨论这个问题。如注释中所述,解决方案在于指定希望从中使用边距函数的包;在这种情况下,随机森林 因此,要更改的代码行是

plot(randomForest::margin(iris.rf))

我自己也插手了这个问题。如注释中所述,解决方案在于指定希望从中使用边距函数的包;在这种情况下,随机森林 因此,要更改的代码行是

plot(randomForest::margin(iris.rf))

我这边没有错误。您在哪个系统上?好的,我重新启动了会话,无论出于何种原因,现在都可以指定
randomForest::margin()
以避免此错误。其他软件包(
ggplot2
)中有
margin
函数。我这边没有错误。您在哪个系统上?好的,我重新启动了会话,无论出于什么原因,现在都可以指定
randomForest::margin()
,以避免此错误。其他软件包(
ggplot2
)中有
margin
函数。