我有一个33行7列的小型数据集,很抱歉,我无法共享自己的数据,因为它是客户数据。我需要使用此数据集构建回归模型。我想用弹力网。我没有在R中实现弹性网的任何经验。因此,我引用了此链接http://www.sthda.com/english/articles/37-model-selection-essentials-in-r/153-penalized-regression-essentials-ridge-lasso-elastic-net/#elastic-net并按照以下步骤进行操作。我的弹性网代码如下所示:
model <- train(
dataReg$sales ~., data = dataReg, method = "glmnet",
trControl = trainControl("cv", number = 10),
tuneLength = 10
)
但是我收到错误消息
Error in `[.data.frame`(data, , all.vars(Terms), drop = FALSE) :
undefined columns selected
In addition: Warning message:
In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo, :
There were missing values in resampled performance measures.
检查了我的数据集dataReg $ sales给了我33条记录,我的数据未包含任何缺失值。您能指导我解决问题吗?