4

I want to get a list of all clustering algorithms integrated in the mlr package. I excpected this code to return them, but it excludes the uninstalled ones:

library(mlr)
listLearners("cluster") # default: create=F, check.packages=F

Instead I get the following warning:

Warning in listLearners.character("cluster") :
  The following learners could not be constructed, probably because their packages are not installed:
classif.ada,classif.bartMachine,classif.bdk,classif.blackboost,classif.boosting,classif.bst,classif.C50,classif.clusterSVM,classif.cvglmnet,classif.dbnDNN,classif.dcSVM,classif.earth,classif.evtree,classif.extraTrees,classif.fnn,classif.gamboost,classif.gaterSVM,classif.geoDA,classif.glmboost,classif.glmnet,classif.hdrda,classif.kknn,classif.LiblineaRL1L2SVC,classif.LiblineaRL1LogReg,classif.LiblineaRL2L1SVC,classif.LiblineaRL2LogReg,classif.LiblineaRL2SVC,classif.LiblineaRMultiClassSVC,classif.linDA,classif.lqa,classif.mda,classif.mlp,classif.neuralnet,classif.nnTrain,classif.nodeHarvest,classif.pamr,classif.penalized.fusedlasso,classif.penalized.lasso,classif.penalized.ridge,classif.plr,classif.quaDA,classif.randomForestSRC,classif.ranger,classif.rda,classif.rFerns,classif.rknn,classif.rotationForest,classif.RRF,classif.rrlda,classif.saeDNN,classif.sda,classif.sparseLDA,classif.xgboost [... truncated]

Am I doing something wrong or is this function broken?

tover
  • 535
  • 4
  • 11

2 Answers2

3

The default of check.packages is actually TRUE when you pass a string. Just set it to FALSE and everything should work:

listLearners("cluster", check.packages = FALSE)
Lars Kotthoff
  • 107,425
  • 16
  • 204
  • 204
  • I am getting more and more confused by this function: Here it says the default is FALSE: args(listLearners) function (obj = NA_character_, properties = character(0L), quiet = TRUE, warn.missing.packages = TRUE, check.packages = FALSE, create = FALSE) NULL but it only works when I explicitly write the check.packages = FALSE. BTW: to avoid the warnings I found out that I have to set warn.missing.packages = F – tover Aug 02 '17 at 19:33
  • 1
    Did you check the documentation for the S3 generic for character? This is the function that will be called if you give it a string (you can also give a task, for example). – Lars Kotthoff Aug 02 '17 at 19:40
  • Didn't think of that: > argsAnywhere(listLearners.character) function (obj = NA_character_, properties = character(0L), quiet = TRUE, warn.missing.packages = TRUE, check.packages = TRUE, create = FALSE). Turns out all methods have check.packages set to TRUE. So what could be the reason for having a default value in a dispatcher when every method overrides it? – tover Aug 02 '17 at 19:55
  • 1
    You're right, this is weird and almost certainly unintentional. I've opened an [issue](https://github.com/mlr-org/mlr/issues/1957) for this. – Lars Kotthoff Aug 02 '17 at 20:01
2

tl;dr

you can find them here.

Explanation

If you set

options(warning.length = 8170)

you can get the whole warning message. This ends with

"..... classif.penalized.ridge,classif.plr,classif.quaDA,classif.randomForestSRC,classif.ranger,classif.rda,classif... <truncated> Check ?learners to see which packages you need or install mlr with all suggestions."

If you then check ?learners you will see a hint where to acquire the information:

All supported learners can be found by listLearners or as a table in the tutorial appendix: http://mlr-org.github.io/mlr-tutorial/release/html/integrated_learners/.

So, this is the website where all classifiers are gathered.
On the left side, you can jump to all "Cluster analysis" Learners.

loki
  • 9,816
  • 7
  • 56
  • 82
  • So this means, that there are only the 9 learners integrated which are actually shown by listLearners. But why do I get the warning message (which I must admit, I haven't read very thoroughly before posting this question), which includes numerous packages for non clustering tasks (I asked the listLearners command for clustering algorithms and without creating and checking)? – tover Aug 02 '17 at 13:35
  • as you can see, the warning includes `classif.xxx`. So, obviously the warning does not differentiate. – loki Aug 02 '17 at 13:47
  • That's what I mean. The function shouldn't even look for installed.packages at all when I set create and check.packages to FALSE. And even if it did, it shouldn't look for the ones not suitable to clustering. So either I still haven't gotten the idea behind those function arguments or this function has a bug. – tover Aug 02 '17 at 13:51