mlr_coercions: Object Coercion

Description Usage Arguments Value Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
## S3 method for class 'character'
as_task(x, clone = FALSE)

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

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

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

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

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

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

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

as_task(x, clone = FALSE)

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

as_tasks(x, clone = FALSE)

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

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

as_learner(x, clone = FALSE)

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

as_learners(x, clone = FALSE)

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

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

as_resampling(x, clone = FALSE)

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

as_resamplings(x, clone = FALSE)

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

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

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

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

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

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

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

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

## S3 method for class '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

1
2
3
# convert single measure to list of measures
measure = msr("classif.ce")
as_measures(measure)

mllg/mlr3 documentation built on Sept. 27, 2019, 9:38 a.m.