mlr-org / mlr3misc

Miscellaneous helper functions for mlr3
https://mlr3misc.mlr-org.com
GNU Lesser General Public License v3.0
11 stars 2 forks source link

Suggestion: `Dictionary$help()` function #72

Open mb706 opened 2 years ago

mb706 commented 2 years ago

For many objects there is lrn("xxx")$help(), but the dictionary can also contain entries that do not map 1-to-1 with R6-classes, such as ppl(), which constructs different Graphs. However, we have the nomenclature of <dictname>_<key> for help files. I therefore suggest that Dictionary$help(<key>) tries to show help for the <dictname>_<key> help entry (and, failing that, tries to construct <key> and call its help() function.

mb706 commented 2 years ago

Usage would then look like

ppl()$help("robustify")

(because ppl() with empty arguments returns the dictionary)

mb706 commented 2 years ago

For this, $add() would probably need a package argument that defaults to the name of the "topenv" of the calling frame or something like that.

mb706 commented 2 years ago

To construct a minimal object to call $help() on, some of the items need some extra construction item that is not otherwise supplied, e.g. PipeOpLearner$new() needs a Learner-like object. This would be the opportunity to also support that: add an auxiliary construction arguments option to Dictionary$add() (as I am doing here, see example usage here, note the alist!) and then use that to construct an object for $help() access (as here).

Maybe this line, without the $help(), could then also be a helper function, get_dummy(), that could then be used by as.data.table().