mlr3r-ranger

Variable Importance P-Values


Can the importance_pvalues (https://rdrr.io/cran/ranger/man/importance_pvalues.html) command be used via mlr3? In other words, can I indicate that I would like the p-values outputted in my call to the learner? If not, how would I go about extracting the ranger object to use as input for the importance_pvalues command?


Solution

  • You can always access the stored model via the $model field in mlr3.

    library(mlr3verse)
    library(ranger)
    
    learner = lrn("classif.ranger", importance = "impurity_corrected")
    learner$train(tsk("sonar"))
    
    importance_pvalues(learner$model)