2

I recently came across the random search option in caret's trainControl() Funktion. How does caret generate the parameters and is there a ways to provide some sort of user-specific input (e.g. a distributions where the parameters are sampled from)? On the website I only found this quote:

built-in models contained in caret contain code to generate random tuning parameter combinations

For example, I tried mxnet with caret and random search:

# Train control with random search
rs_control <- trainControl(method = "boot", 
                           number = 2, 
                           search = "random",
                           verboseIter = TRUE
                           )

# Training
model_fit <- train(form = y ~ .,
                   data = df_train,
                   method = "avMxnet",
                   preProcess = c("center", "scale"),
                   tuneLength = 20,
                   trControl = rs_control
                   )    

Using this code, caret sampled reasonable values for the number of neurons on the first layer and other parameters (learningrate, momentum, dropout and repeats) but keep the second/third layer constant at zero. Is there a ways to tell caret to sample for all three layers with a uniform distribution from e.g. [25, 150]?

winwin
  • 384
  • 6
  • 20

1 Answers1

1

First, I'm not sure what version of caret you are using since that model is not available

> library(caret)
> getModelInfo("avMxnet")
Error in getModelInfo("avMxnet") : 
  That model is not in caret's built-in library

This is with the CRAN version caret_6.0-70.

I'm assuming that you are using the code on github. If that is the case, you can alter the grid code and have it generate any random search grid that you like.

topepo
  • 13,534
  • 3
  • 39
  • 52
  • I am using CRAN version caret_6.0-68 and `getModelInfo("avMxnet")` ist actually working for me.. Maybe you have to install mxnet in the first place... What do you mean with 'the code on github'? – winwin Aug 05 '16 at 11:31
  • I'd love to have mxnet in caret! ;) – Richi W Aug 05 '16 at 13:02
  • As far as I can say, it is already supported: http://topepo.github.io/caret/modelList.html – winwin Aug 06 '16 at 14:10