1
1
# ' Declare post-processing for model predictions
2
2
# '
3
- # ' @param mode The model's mode, one of `"classification"`, or `"regression"`.
4
- # ' Modes of `"censored regression"` are not currently supported.
5
3
# ' @param type The model sub-type. Possible values are `"unknown"`, `"regression"`,
6
4
# ' `"binary"`, or `"multiclass"`.
7
5
# ' @param outcome The name of the outcome variable.
14
12
# ' @param time The name of the predicted event time. (not yet supported)
15
13
# ' @examples
16
14
# '
17
- # ' container(mode = "regression" )
15
+ # ' container()
18
16
# ' @export
19
- container <- function (mode , type = " unknown" , outcome = NULL , estimate = NULL ,
17
+ container <- function (type = " unknown" , outcome = NULL , estimate = NULL ,
20
18
probabilities = NULL , time = NULL ) {
21
19
columns <-
22
20
list (
@@ -28,7 +26,6 @@ container <- function(mode, type = "unknown", outcome = NULL, estimate = NULL,
28
26
)
29
27
30
28
new_container(
31
- mode ,
32
29
type ,
33
30
operations = list (),
34
31
columns = columns ,
@@ -37,13 +34,7 @@ container <- function(mode, type = "unknown", outcome = NULL, estimate = NULL,
37
34
)
38
35
}
39
36
40
- new_container <- function (mode , type , operations , columns , ptype , call ) {
41
- mode <- arg_match0(mode , c(" regression" , " classification" ))
42
-
43
- if (mode == " regression" ) {
44
- type <- " regression"
45
- }
46
-
37
+ new_container <- function (type , operations , columns , ptype , call ) {
47
38
type <- arg_match0(type , c(" unknown" , " regression" , " binary" , " multiclass" ))
48
39
49
40
if (! is.list(operations )) {
@@ -58,11 +49,11 @@ new_container <- function(mode, type, operations, columns, ptype, call) {
58
49
}
59
50
60
51
# validate operation order and check duplicates
61
- validate_order(operations , mode , call )
52
+ validate_order(operations , type , call )
62
53
63
54
# check columns
64
55
res <- list (
65
- mode = mode , type = type , operations = operations ,
56
+ type = type , operations = operations ,
66
57
columns = columns , ptype = ptype
67
58
)
68
59
class(res ) <- " container"
@@ -120,7 +111,6 @@ fit.container <- function(object, .data, outcome, estimate, probabilities = c(),
120
111
object <- set_container_type(object , .data [[columns $ outcome ]])
121
112
122
113
object <- new_container(
123
- object $ mode ,
124
114
object $ type ,
125
115
operations = object $ operations ,
126
116
columns = columns ,
0 commit comments