1
votes

while using regr.ranger I'm getting an error message that says importance.mode must be one of "impurity" etc.

While using regr.rfsrc it says I should specify 'importance' to one of 'TRUE' etc.

I just want to understand at what stage should I assign the value to 'importance'.

I get an error if I do it while creating the learner.

> lrnr_ranger = mlr_learners$get(key = "regr.ranger",importance="impurity")
Error in initialize(...) : unused argument (importance = "impurity")

or

> lrnr_ranger = mlr_learners$get(key = "regr.ranger",importance.mode="impurity")
Error in initialize(...) : unused argument (importance.mode = "impurity")

or should I try to set it using the param_set:

> lrnr_ranger$param_set$add(p = list("importance.mode","impurity"))
Error in .__ParamSet__add(self = self, private = private, super = super,  : 
  Assertion on 'p' failed: Must inherit from class 'Param'/'ParamSet', but has class 'list'.

Any clue would be super helpful.

I'm not really reporting a problem but asking how to do something. (Hence, I believe no need to create a reprex!)

I wish this was addressed in the mlr3 book or some documentation but it is not.

1
In your third attempt you tried to add another hyperparameter. Instead you can set the hyperparameters like this lrnr_ranger$param_set$values = list(importance="impurity")jakob-r

1 Answers

3
votes

This is explained on the learners page of the mlr3 book, in particular at the end:

lrn_ranger = lrn("regr.ranger", importance = "impurity")