+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions R/Filter.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Filter = R6Class("Filter",
#' Identifier for the filter.
#' @param task_type (`character()`)\cr
#' Types of the task the filter can operator on. E.g., `"classif"` or
#' `"regr"`.
#' `"regr"`. Can be set to `NA` to allow all task types.
#' @param param_set ([paradox::ParamSet])\cr
#' Set of hyperparameters.
#' @param feature_types (`character()`)\cr
Expand All @@ -73,8 +73,10 @@ Filter = R6Class("Filter",
packages = character(), man = NA_character_) {

self$id = assert_string(id)
self$task_type = assert_subset(task_type, mlr_reflections$task_types$type,
empty.ok = FALSE)
if (!test_scalar_na(task_type)) {
assert_subset(task_type, mlr_reflections$task_types$type, empty.ok = FALSE)
}
self$task_type = task_type
self$task_properties = assert_subset(
task_properties,
unlist(mlr_reflections$task_properties, use.names = FALSE))
Expand Down Expand Up @@ -137,7 +139,9 @@ Filter = R6Class("Filter",
task = assert_task(as_task(task),
feature_types = self$feature_types,
task_properties = self$task_properties)
assert_choice(task$task_type, self$task_type)
if (!test_scalar_na(self$task_type)) {
assert_choice(task$task_type, self$task_type)
}
fn = task$feature_names

if (task$nrow == 0L) {
Expand Down
2 changes: 1 addition & 1 deletion R/FilterVariance.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ FilterVariance = R6Class("FilterVariance",

super$initialize(
id = "variance",
task_type = c("classif", "regr"),
task_type = NA_character_,
param_set = param_set,
packages = "stats",
feature_types = c("integer", "numeric"),
Expand Down
1 change: 1 addition & 0 deletions man-roxygen/field_task_type.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#' @field task_type (`character(1)`)\cr
#' Task type, e.g. `"classif"` or `"regr"`.
#' Can be set to `NA` to allow all task types.
#'
#' For a complete list of possible task types (depending on the loaded packages),
#' see [`mlr_reflections$task_types$type`][mlr_reflections].
3 changes: 2 additions & 1 deletion man/Filter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载