Configure validation for a graph learner.
In a GraphLearner, validation can be configured on two levels:
On the
GraphLearnerlevel, which specifies how the validation set is constructed before entering the graph.On the level of the individual
PipeOps (such asPipeOpLearner), which specifies which pipeops actually make use of the validation data (set its$validatefield to"predefined") or not (set it toNULL). This can be specified via the argumentids.
Usage
# S3 method for class 'GraphLearner'
set_validate(
learner,
validate,
ids = NULL,
args_all = list(),
args = list(),
...
)Arguments
- learner
(
GraphLearner)
The graph learner to configure.- validate
(
numeric(1),"predefined","test", orNULL)
How to set the$validatefield of the learner. If set toNULLall validation is disabled, both on the graph learner level, but also for all pipeops.- ids
(
NULLorcharacter())
For which pipeops to enable validation. This parameter is ignored whenvalidateis set toNULL. By default, validation is enabled for the finalPipeOpin theGraph.- args_all
(
list())
Rarely needed. A named list of parameter values that are passed to all subsequetset_validate()calls on the individualPipeOps.- args
(named
list())
Rarely needed. A named list of lists, specifying additional argments to be passed toset_validate()when calling it on the individualPipeOps.- ...
(any)
Currently unused.
Examples
library(mlr3)
glrn = as_learner(po("pca") %>>% lrn("classif.debug"))
set_validate(glrn, 0.3)
glrn$validate
#> [1] 0.3
glrn$graph$pipeops$classif.debug$learner$validate
#> [1] "predefined"
set_validate(glrn, NULL)
glrn$validate
#> NULL
glrn$graph$pipeops$classif.debug$learner$validate
#> NULL
set_validate(glrn, 0.2, ids = "classif.debug")
glrn$validate
#> [1] 0.2
glrn$graph$pipeops$classif.debug$learner$validate
#> [1] "predefined"
