Showing 1 of 3 files from the diff.
Newly tracked file
R/task_converters.R changed.
Other files ignored by Codecov

@@ -18,6 +18,7 @@
Loading
18 18
#'   If `TRUE` (default), unused levels of the new target variable are dropped.
19 19
#'
20 20
#' @return [Task] of requested type.
21 +
#' @export
21 22
convert_task = function(intask, target = NULL, new_type = NULL, drop_original_target = FALSE, drop_levels = TRUE) {
22 23
  assert_task(intask)
23 24
  target = assert_subset(target, choices = intask$col_info$id) %??% intask$target_names
@@ -36,8 +37,9 @@
Loading
36 37
  newtask$col_roles[props] = intask$col_roles[props]
37 38
  newtask$set_col_role(target, "target")
38 39
40 +
  # Add the original target(s) as features, only keeping 'new_target'.
39 41
  if (!all(intask$target_names == target)) {
40 -
    newtask$set_col_role(intask$col_roles$target, "feature")
42 +
    newtask$set_col_role(setdiff(intask$col_roles$target, target),  "feature")
41 43
  }
42 44
43 45
  # during prediction, when target is NA, we do not call droplevels
@@ -45,7 +47,7 @@
Loading
45 47
    newtask$droplevels()
46 48
  }
47 49
48 -
  # if drop_original_target, remove the original target from the col_roles
50 +
  # if drop_original_target, remove the original target from the features
49 51
  if (drop_original_target) {
50 52
    newtask$col_roles$feature = setdiff(newtask$col_roles$feature, intask$col_roles$target)
51 53
  }
Files Coverage
R 92.13%
Project Totals (83 files) 92.13%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading