Skip to content

Commit

Permalink
add offset task in autotest
Browse files Browse the repository at this point in the history
  • Loading branch information
bblodfon committed Feb 7, 2025
1 parent 0c1fc7d commit 9c21f84
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions inst/testthat/helper_autotest.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,17 @@ generate_generic_tasks = function(learner, proto) {
# task with weights
if ("weights" %in% learner$properties) {
tmp = proto$clone(deep = TRUE)$cbind(data.frame(weights = runif(n)))
tmp$col_roles$weight = "weights"
tmp$col_roles$features = setdiff(tmp$col_roles$features, "weights")
tmp$set_col_roles(cols = "weights", roles = "weight")
tasks$weights = tmp
}

# task with offset
if ("offset" %in% learner$properties) {
tmp = proto$clone(deep = TRUE)$cbind(data.frame(offset = runif(n)))
tmp$set_col_roles(cols = "offset", roles = "offset")
tasks$offset = tmp
}

# task with non-ascii feature names
if (p > 0L) {
sel = proto$feature_types[list(learner$feature_types), "id", on = "type", with = FALSE, nomatch = NULL][[1L]]
Expand Down

0 comments on commit 9c21f84

Please sign in to comment.