@@ -49,7 +49,7 @@ Filter = R6Class("Filter",
49
49
# ' Identifier for the filter.
50
50
# ' @param task_type (`character()`)\cr
51
51
# ' Types of the task the filter can operator on. E.g., `"classif"` or
52
- # ' `"regr"`.
52
+ # ' `"regr"`. Can be set to `NA` to allow all task types.
53
53
# ' @param param_set ([paradox::ParamSet])\cr
54
54
# ' Set of hyperparameters.
55
55
# ' @param feature_types (`character()`)\cr
@@ -73,8 +73,10 @@ Filter = R6Class("Filter",
73
73
packages = character (), man = NA_character_ ) {
74
74
75
75
self $ id = assert_string(id )
76
- self $ task_type = assert_subset(task_type , mlr_reflections $ task_types $ type ,
77
- empty.ok = FALSE )
76
+ if (! test_scalar_na(task_type )) {
77
+ assert_subset(task_type , mlr_reflections $ task_types $ type , empty.ok = FALSE )
78
+ }
79
+ self $ task_type = task_type
78
80
self $ task_properties = assert_subset(
79
81
task_properties ,
80
82
unlist(mlr_reflections $ task_properties , use.names = FALSE ))
@@ -138,7 +140,9 @@ Filter = R6Class("Filter",
138
140
task = assert_task(as_task(task ),
139
141
feature_types = self $ feature_types ,
140
142
task_properties = self $ task_properties )
141
- assert_choice(task $ task_type , self $ task_type )
143
+ if (! test_scalar_na(self $ task_type )) {
144
+ assert_choice(task $ task_type , self $ task_type )
145
+ }
142
146
fn = task $ feature_names
143
147
144
148
if (task $ nrow == 0L ) {
0 commit comments