举个例子:
lstParams <- list()
lstParams$formula <- as.formula("Sepal.Length ~ Sepal.Width + Petal.Length")
lstParams$data <- substitute(iris)
lstParams$distribution <- "bernoulli"
mdl <- do.call("gbm", lstParams)
mdl
gbm(formula=Sepal.Length ~ Sepal.Width + Petal.Length, distribution="bernoulli",
data=iris)
# A gradient boosted model with bernoulli loss function.
# 100 iterations were performed.
# There were 2 predictors of which 0 had non-zero influence.
我可以通过以下方式调用gbm
函数:
mdl$call
gbm(formula=Sepal.Length ~ Sepal.Width + Petal.Length, distribution="bernoulli",
data=iris)
由于:mdl<-do.call("gbm",lstParams)
中可能会发生一些错误(例如,在目标变量中发现了一些NAS或错误的公式):
lstParams <- list()
lstParams$formula <- as.formula("Sepal.Length ~ Sepal.Width + Petal.Lengthx")
lstParams$data <- substitute(iris)
lstParams$distribution <- "bernoulli"
mdl <- do.call("gbm", lstParams)
# Error in eval(predvars, data, env) : object 'Petal.Lengthx' not found
I would like to get the call to 100 function in advance,以便进行调试.
有没有办法在行刑前接到那个电话? 谢谢