当我运行下面的代码时,R 崩溃了。如果我在 train 调用中注释掉 tuneGrid 行,则不会发生崩溃。我已经用另一个数据集尝试过这个,但仍然崩溃 R。崩溃消息是 R 会话中止 R 遇到致命错误会话被终止启动新会话。
代码是:
library(splines)
library(foreach)
library(gam)
library(lattice)
library(ggplot2)
library(caret)
# crashes when I uncomment the tuneGrid = tuneGrid line
Set_seed_seed <- 100
data_set <- diamonds[, c(1, 5, 6, 7, 8, 9, 10)]
data_set <- data_set[1:1000,]
formula <- price ~ carat + depth + table + x + y + z
training_control <- trainControl(method = "cv", allowParallel = FALSE)
tune_grid <- expand.grid(span = seq(0.1, 0.9, length = 9), degree = seq(1, 2, length = 2))
set.seed(Set_seed_seed)
GAM_model <- train(formula,
data = data_set,
method = "gamLoess",
tuneGrid = tune_grid,
trControl = training_control
)
这发生在使用 R Studio 的 R3.2.1 和 3.2.2 中。
在 R gui 中,也会崩溃。