构建BRT回归树模型,报错显示“closure的对象不可以取子集”,代码如下,新手小白,望各位前辈指教
> split<- sample(nrow(data1), nrow(data1)*0.8)
> train<- data1[split, ]
> test<- data1[-split, ]
> mod1 = gbm(shenti~ ., data =train)
Distribution not specified, assuming gaussian ...
> gbm(
+ formula = formula(data),
+ distribution = "gaussian",
+ data = data,
+ weights,
+ var.monotone = NULL,
+ n.trees = 1000,
+ interaction.depth = 3,
+ n.minobsinnode = 5,
+ shrinkage = 0.01,
+ bag.fraction = 0.5,
+ train.fraction = 1,
+ cv.folds = 10,
+ keep.data = TRUE,
+ verbose = TRUE,
+ class.stratify.cv = NULL,
+ n.cores = NULL)
错误: 类别为'closure'的对象不可以取子集