Home > database >  Set hyper-parameters to tune with makeParamSet
Set hyper-parameters to tune with makeParamSet

Time:07-02

I am running random forest classification in R with mlr package. I would like to tune the following hyper-parameters: number of trees, number of variables to consider at each split, terminal node size and tree depth. I am using makeParamSet from mlr build the set of parameters to be tuned, and here is the code:

rf_param <- makeParamSet(
makeIntegerParam("ntree", lower=50, upper =500),  
makeIntegerParam("mtry", lower =floor((ncol(train)-1)/5), upper = ncol(train)),
makeIntegerParam("nodesize", lower =10, upper = 30),
makeIntegerParam("maxnodes", lower =1, upper =100 ))

However, in this way each integer from 50 to 500 , in the case of trees, is considered when choosing the optimal trees number. Instead, I would like to evaluate tree numbers by 50 (i.e. 50 100 150 ... 500). Is it possible to do that with makeParamSet? Thanks!

CodePudding user response:

You could use makeDiscreteParam, like this:

makeDiscreteParam("ntree", values = seq(50,500,50))
  • Related