Set class weight hyper-parameters to tune with makeParamSet in R

20 Views Asked by At

Hi I am trying to figure out how to set a parameter for class weights using makeParamSet from ParamHelpers R library.

My code currently looks like this:

ps <- makeParamSet(makeDiscreteParam("mtry", values=seq(3, 6, 9)),
                   makeDiscreteParam("num.trees",values=seq(50,100)),
                   makeDiscreteParam("max.depth", values=seq(5,10,15)),
                   makeDiscreteParam("min.node.size", values=seq(5,100,1000)),
                  makeDiscreteParam("class.weights",values=c(seq(1,1),seq(1,2))))

Once ran I get the following error:

Not all values for parameter 'class.weights' were named and names could not be guessed!

How do you correctly specify arguments for this parameter? I want to pass it class weights as {0:1,1;1} and {0:1,1:2} where target variable is named "label".

A python equivalent would be:

param_grid={'class_weight':[{0: 1, 1: 1},{0:1,1:2}]}

Thanks!

0

There are 0 best solutions below