How to set 'importance' for finding variable importance for various regression learners in mlr3

Viewed 248

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 Answers
Related