I'm trying to do a cross validation resampling using the caret package but the function I want to train need some parameters. I want to use the function nmf from the package NMF:
res <- nmf(dfrm, 6, nrun=20)
and the code
inTraining <- createDataPartition(dfrm, p = .8, list = FALSE, times = 200)
training <- dfrm[ inTraining,]
testing <- dfrm[-inTraining,]
fitControl <- trainControl(## 5-fold cv
method = "cv",
number = 5
)
cv_result <- train(dfrm.T, res,
data = training,
method = "nmf",
trControl = fitControl)
but if I just put nmf in the methods it's not going to use the 6 and nrun=20. How can I adjust it? thanks
nmf is not an available method in caret.
Using additional function parameters in train is possible. For example the ntree argument with randomForest. Tuning is only on mtry, but you can add additional function parameters.
train(Species ~ ., data = iris, method = "rf", ntree = 10)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.