mlr-org / mlr

Machine Learning in R
https://mlr.mlr-org.com
Other
1.64k stars 405 forks source link

construct learners without loading packages? #580

Closed berndbischl closed 8 years ago

berndbischl commented 8 years ago

the packages could be loaded in the trainLearber and predictLearner functions.

The objects are just a bunch of properties. The only problem are some objects in the ParamSet, which are from underlying packages. I am unsure what to do about them,

Actually we kinda have code that allows "peeking" at learner properties in listLearners without loading their packages. Maybe this could be generalized to return a table of properties?

larskotthoff commented 8 years ago

I guess the only sure way to see if a learner works is to actually instantiate it and load the package. Just checking whether the package is installed won't do that (e.g. XMeans requires a Weka package to be installed in addition to RWeka). So in that respect I wouldn't want to remove this completely.

berndbischl commented 8 years ago

I am working on this option now: We already have listLearners(create = F). This return a char vec of classes. But we already peek into the properties of the learner, without constructing them, with reflection-magic. I am working on an option "table" that returns a table of info about the learners, basically what we have in the tutorial, without loading the package.

berndbischl commented 8 years ago

I am actually nearly done.

I looks like this

> d = listLearners("regr", table  = T)
> str(d)
'data.frame':   52 obs. of  11 variables:
 $ id        : chr  "regr.avNNet" "regr.bartMachine" "regr.bcart" "regr.bdk" ...
 $ package   : chr  "nnet" "bartMachine" "tgp" "kohonen" ...
 $ short.name: chr  "avNNet" "bartmachine" "bcart" "bdk" ...
 $ name      : chr  "Neural Network" "Bayesian Additive Regression Trees" "Bayesian CART" "Bi-Directional Kohonen map" ...
 $ numerics  : logi  TRUE TRUE TRUE TRUE TRUE TRUE ...
 $ factors   : logi  TRUE TRUE TRUE FALSE FALSE FALSE ...
 $ ordered   : logi  FALSE FALSE FALSE FALSE FALSE FALSE ...
 $ missings  : logi  FALSE TRUE FALSE FALSE FALSE FALSE ...
 $ weights   : logi  TRUE FALSE FALSE FALSE FALSE FALSE ...
 $ prob      : logi  FALSE FALSE FALSE FALSE FALSE FALSE ...
 $ se        : logi  FALSE FALSE TRUE FALSE TRUE TRUE ...

comments before i go further? @schiffner

berndbischl commented 8 years ago

"table = T" is only viable if "create = F". then it returns this info table instead of the classes as a char vec.

berndbischl commented 8 years ago

no packages are loaded in that case if create = F

berndbischl commented 8 years ago

I have created a branch listLearners_table for the nearly finished code

berndbischl commented 8 years ago

was solved by myself and @schiffner PRs:

611

631

schiffner commented 8 years ago

Thx, I always seem to forget the cross-references... :)

berndbischl commented 8 years ago

Doesnt matter, it will always work out. Also this is why we review each other :)