简体   繁体   English

如何调整火车功能的方法中的参数(插入符号)

[英]how adjust parameters in method of train function (caret package)

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: 我想使用NMF软件包中的函数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. 但是,如果仅将nmf放入方法中,则不会使用6和nrun = 20。 How can I adjust it? 我该如何调整? thanks 谢谢

nmf is not an available method in caret. nmf在插入符号中不是可用的方法。

Using additional function parameters in train is possible. 可以在火车上使用其他功能参数。 For example the ntree argument with randomForest. 例如,带有randomForest的ntree参数。 Tuning is only on mtry, but you can add additional function parameters. 仅在mtry上进行调优,但是您可以添加其他功能参数。

train(Species ~ ., data = iris, method = "rf", ntree = 10)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM