r gbm包汇总函数执行错误

时间:2018-05-20 03:53:26

标签: r gbm

我正在尝试在r中使用gbm包,并且我遇到了汇总函数的问题。希望有人可以帮忙。我的代码如下:

library(ISLR)
Caravan$Purchase <- ifelse(Caravan$Purchase == "Yes", 1, 0)
train_index <- 1:1000
train <- Caravan[train_index, ]
test <- Caravan[-train_index, ]

library(gbm)
set.seed(1234)
boost <- gbm(Purchase ~ ., data = train, n.trees=400, shrinkage =0.01,
             distribution = "bernoulli")
summary(boost)

我收到以下跟踪错误消息:

Error in plot.window(xlim, ylim, log = log, ...) : need finite 'xlim' values
5.
plot.window(xlim, ylim, log = log, ...)
4.
barplot.default(rel.inf[i[cBars:1]], horiz = TRUE, col = rainbow(cBars, start = 3/6, end = 4/6), names = object$var.names[i[cBars:1]], xlab = "Relative influence", ...)
3.
barplot(rel.inf[i[cBars:1]], horiz = TRUE, col = rainbow(cBars, start = 3/6, end = 4/6), names = object$var.names[i[cBars:1]], xlab = "Relative influence", ...)
2.
summary.gbm(boost)
1.
summary(boost)

我尝试使用此处的解决方法:http://www.samuelbosch.com/2015/09/workaround-ntrees-is-missing-in-r.html无效。

有什么建议吗?

编辑1:R 3.5.0中发生确认错误,但3.4.4中未发生。

0 个答案:

没有答案