2017-06-16 169 views
0

有人可以解釋TuneLength如何在不同的模型中使用Caret包的火車功能?Caret R中的TuneLength定義

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

在這種情況下,tuneLength已被用於定義每個分割中使用的預測變量的數量?

+0

請閱讀https://topepo.github.io/caret上的文檔 – topepo

回答

0

這一切都取決於模型。插入符號內的寶貴功能是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()