J.Ze
J.Ze

Reputation: 73

TuneLength definition in Caret R

How does tuneLength work in different models in the train function of the Caret package?

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

In this case, has tuneLength been used to define the number of predictors that are used in each split?

Upvotes: 1

Views: 2332

Answers (1)

Omar
Omar

Reputation: 635

It all depends on the model. A valuable function within caret is modelLookup(). Pass a string with the name of the model you’re using, for example modelLookup("rf") and it will tell you which parameter is being tuned by tunelength. In your case above :

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

You can also specify your own range of tuning in a more customized way, if you want to try out specific values. For that, pass a data frame with column names matching those of the arguments from modelLookup() or if you have many of them for the specific model you're using, try expand.grid().

Upvotes: 2

Related Questions