Configure validation for a graph learner.
In a GraphLearner
, validation can be configured on two levels:
On the
GraphLearner
level, which specifies how the validation set is constructed before entering the graph.On the level of the individual
PipeOp
s (such asPipeOpLearner
), which specifies which pipeops actually make use of the validation data (set its$validate
field 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$validate
field of the learner. If set toNULL
all validation is disabled, both on the graph learner level, but also for all pipeops.- ids
(
NULL
orcharacter()
)
For which pipeops to enable validation. This parameter is ignored whenvalidate
is set toNULL
. By default, validation is enabled for the finalPipeOp
in theGraph
.- args_all
(
list()
)
Rarely needed. A named list of parameter values that are passed to all subsequetset_validate()
calls on the individualPipeOp
s.- args
(named
list()
)
Rarely needed. A named list of lists, specifying additional argments to be passed toset_validate()
when calling it on the individualPipeOp
s.- ...
(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"