Search code examples
machine-learningmlr3

creating learner in mlr3: Error in sprintf(msg, ...) : too few arguments


I want to create a learner in mlr3, using the distRforest package.

my code:

library(mlr3extralearners)

create_learner( pkg = "." ,
            classname = 'distRforest',
            algorithm = 'regression tree',
            type = 'regr',
            key = 'distRforest',
            package = 'distRforest',
            caller = 'rpart',
            feature_types = c("logical", "integer", "numeric","factor", "ordered"),
            predict_types = c('response'),
            properties = c("importance", "missings", "multiclass",
                           "selected_features", "twoclass", "weights"),
            references = FALSE,
            gh_name = 'CL'

)

gives the following error : Error in sprintf(msg, ...) : too few arguments

in fact, replicating the code in the tutorial https://mlr3book.mlr-org.com/extending-learners.html throws the same error.

Any ideas? Thanks a lot - c


Solution

  • thanks for your interest in extending the mlr3 universe! Couple of things, firstly the example in the book works fine for me, and secondly your example cannot work because you are including classif properties for a regr learner. As I am unable to reproduce your error it's hard for me to debug what's going wrong, it would be helpful if you could run the following:

    reprex::reprex({
      create_learner(
        pkg = ".",
        classname = "Rpart",
        algorithm = "decision tree",
        type = "classif",
        key = "rpartddf",
        package = "rpart",
        caller = "rpart",
        feature_types = c("logical", "integer", "numeric", "factor", "ordered"),
        predict_types = c("response", "prob"),
        properties = c("importance", "missings", "multiclass", "selected_features", "twoclass", "weights"),
        references = TRUE,
        gh_name = "CL"
      )
    }, si = TRUE)
    
    

    If you're still getting an error and the output is too long to print here then head over to the GitHub and open an issue there.