r gbm程序包摘要函数执行错误

r gbm程序包摘要函数执行错误,r,gbm,R,Gbm,我试图在r中使用gbm包,但在summary函数中遇到问题。希望有人能帮忙。我的代码如下: 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) boo

我试图在r中使用gbm包,但在summary函数中遇到问题。希望有人能帮忙。我的代码如下:

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)
我尝试过使用这里的变通方法:没有用

有什么建议吗


编辑1:确认错误出现在R3.5.0中,但没有出现在3.4.4中。

您的代码在我的机器上运行时没有错误(Rv3.4.1、gbm 2.1.3、ISLR 1.2),绘图也正确呈现。嗯,好的,也许我在R3.5.0上遇到了问题
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)