Skip to content

Commit

Permalink
Merge pull request #735 from mlr-org/ppl_robustify_leaner_params
Browse files Browse the repository at this point in the history
don't use superfluous functions in pipeline robustify
  • Loading branch information
mb706 authored Nov 15, 2023
2 parents dae03af + 3c07bdf commit a85f352
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions R/pipeline_robustify.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,23 +142,23 @@ pipeline_robustify = function(task = NULL, learner = NULL,
pos_removeconstants_1 = pos("removeconstants", id = "removeconstants_prerobustify", na_ignore = FALSE)

pos_character = switch(character_action,
`factor!` = pos("colapply", id = "char_to_fct", affect_columns = selector_type("character"), applicator = function(x) as.factor(x)),
`factor!` = pos("colapply", id = "char_to_fct", affect_columns = selector_type("character"), applicator = as.factor),
`matrix!` = pos("textvectorizer"),
`ignore!` = NULL,
stopf("unexpected value of character_action: %s", character_action)
)

pos_POSIXct = switch(POSIXct_action,
`numeric!` = pos("colapply", id = "POSIXct_to_dbl", affect_columns = selector_type("POSIXct"), applicator = function(x) as.numeric(x)),
`numeric!` = pos("colapply", id = "POSIXct_to_dbl", affect_columns = selector_type("POSIXct"), applicator = as.numeric),
`datefeatures!` = pos("datefeatures"),
`ignore!` = NULL,
stopf("unexpected value of POSIXct_action: %s", POSIXct_action)
)

pos_ordered = switch(ordered_action,
`numeric!` = pos("colapply", id = "ord_to_dbl", affect_columns = selector_type("ordered"), applicator = function(x) as.numeric(x)),
`integer!` = pos("colapply", id = "ord_to_int", affect_columns = selector_type("ordered"), applicator = function(x) as.integer(x)),
`factor!` = pos("colapply", id = "ord_to_fct", affect_columns = selector_type("ordered"), applicator = function(x) as.factor(x)),
`numeric!` = pos("colapply", id = "ord_to_dbl", affect_columns = selector_type("ordered"), applicator = as.numeric),
`integer!` = pos("colapply", id = "ord_to_int", affect_columns = selector_type("ordered"), applicator = as.integer),
`factor!` = pos("colapply", id = "ord_to_fct", affect_columns = selector_type("ordered"), applicator = as.factor),
`ignore!` = NULL,
stopf("unexpected value of ordered_action: %s", ordered_action)
)
Expand Down

0 comments on commit a85f352

Please sign in to comment.