S3 generics and methods to coerce to (lists of) Task, Learner, Resampling, Measure and Prediction.

as_task(x, clone = FALSE)

# S3 method for Task
as_task(x, clone = FALSE)

as_tasks(x, clone = FALSE)

# S3 method for list
as_tasks(x, clone = FALSE)

# S3 method for Task
as_tasks(x, clone = FALSE)

as_learner(x, clone = FALSE)

# S3 method for Learner
as_learner(x, clone = FALSE)

as_learners(x, clone = FALSE)

# S3 method for list
as_learners(x, clone = FALSE)

# S3 method for Learner
as_learners(x, clone = FALSE)

as_resampling(x, clone = FALSE)

# S3 method for Resampling
as_resampling(x, clone = FALSE)

as_resamplings(x, clone = FALSE)

# S3 method for list
as_resamplings(x, clone = FALSE)

# S3 method for Resampling
as_resamplings(x, clone = FALSE)

as_measure(x, task_type = NULL, clone = FALSE)

# S3 method for `NULL`
as_measure(x, task_type = NULL, clone = FALSE)

# S3 method for Measure
as_measure(x, task_type = NULL, clone = FALSE)

as_measures(x, task_type = NULL, clone = FALSE)

# S3 method for `NULL`
as_measures(x, task_type = NULL, clone = FALSE)

# S3 method for list
as_measures(x, task_type = NULL, clone = FALSE)

# S3 method for Measure
as_measures(x, task_type = NULL, clone = FALSE)

Arguments

x

(any)
Object to coerce.

clone

(logical(1))
If TRUE, ensures that the returned object is not the same as the input x, e.g. by cloning it or constructing it from a dictionary such as mlr_learners.

task_type

(character(1))
Used if x is NULL to construct a default measure for the respective task type. The default measures are stored in mlr_reflections$default_measures.

Value

Coerced object. The default method will return the object as-is. Failed coercions have to be handled by on of the assertions in mlr_assertions.

Examples

# convert single measure to list of measures measure = msr("classif.ce") as_measures(measure)
#> [[1]] #> <MeasureClassifSimple:classif.ce> #> * Packages: mlr3measures #> * Range: [0, 1] #> * Minimize: TRUE #> * Properties: - #> * Predict type: response #>