Closed Robinlovelace closed 4 years ago
listLearners()
will only list the learners that are available, i.e. if RWeka isn't installed, none of its learners will be listed. This isn't an error.
Thanks. @larskotthoff Runing the code shows clearly an error and @Robinlovelace is right here that it shouldn't fail if the package is not available. There is even the explicit arg check.packages
.
The reason for the error comes from
When pkg::fun
is called in the ParamSet, we implicitly require the package. I came across this just recently in a similar way for an FDA learner.
Correct behavior should look as follows (where {rpart} is missing)
library(mlr)
#> Loading required package: ParamHelpers
#> 'mlr' is in maintenance mode since July 2019. Future development
#> efforts will go into its successor 'mlr3' (<https://mlr3.mlr-org.com>).
foo = listLearners(iris.task, check.packages = FALSE, warn.missing.packages = TRUE)
#> Warning in listLearners.character(td$type, union(props, properties), quiet, : The following learners could not be constructed, probably because their packages are not installed:
#> classif.ada,classif.boosting,classif.bst,classif.classiFunc.kernel,classif.classiFunc.knn,classif.rpart,regr.bst,regr.rpart,surv.rpart
#> Check ?learners to see which packages you need or install mlr with all suggestions.
Created on 2020-01-12 by the reprex package (v0.3.0)
I'll push a fix in the next days. Thanks for reporting!
Ah sorry, I misunderstood the issue as the opposite of what it was!
See here for context: https://github.com/Robinlovelace/geocompr/issues/459#issuecomment-573436563
This made Geocomputation with R code crash I think...
Thanks.