mlr3 (version 0.1.4)

as_task.character: Object Coercion

Description

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

Usage

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

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

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

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

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

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

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

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

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 mlr3misc::Dictionary.

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

Run this code
# NOT RUN {
# convert single measure to list of measures
measure = msr("classif.ce")
as_measures(measure)
# }

Run the code above in your browser using DataCamp Workspace