插入符 R 中的 TuneLength 定义

问题描述 投票:0回答:1

Caret包的train函数中

tuneLength
如何在不同模型中工作?

ctreeModel <- train(CompressiveStrength ~ .,
+ data = trainingSet,
+ method = "ctree",
+ tuneLength = 10,
+ trControl = controlObject)

在这种情况下,是否使用

tuneLength
来定义每个分割中使用的预测变量的数量?

r r-caret
1个回答
2
投票

这一切都取决于型号。插入符号中一个有价值的函数是

modelLookup()
。传递一个包含您正在使用的模型名称的字符串,例如
modelLookup("rf")
,它会告诉您
tunelength
正在调整哪个参数。在你上面的情况下:

> modelLookup("ctree")
  model    parameter                 label forReg forClass probModel
1 ctree mincriterion 1 - P-Value Threshold   TRUE     TRUE      TRUE

如果您想尝试特定值,您还可以以更定制的方式指定您自己的调整范围。为此,请传递一个数据框,其列名称与

modelLookup()
中的参数相匹配,或者如果您有许多用于您正在使用的特定模型的数据框,请尝试
expand.grid()

© www.soinside.com 2019 - 2024. All rights reserved.