Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PipeOpUpdateTarget doesn't work for survival tasks with 2 target columns #734

Open
bblodfon opened this issue Sep 5, 2023 · 0 comments
Open

Comments

@bblodfon
Copy link

bblodfon commented Sep 5, 2023

library(mlr3proba)
#> Loading required package: mlr3
task = tsk('lung')

trgs = task$data(cols = task$target_names)
trgs
#>      time status
#>   1:  306   TRUE
#>   2:  455   TRUE
#>   3: 1010  FALSE
#>   4:  210   TRUE
#>   5:  883   TRUE
#>  ---            
#> 224:  188  FALSE
#> 225:  191  FALSE
#> 226:  105  FALSE
#> 227:  174  FALSE
#> 228:  177  FALSE

trafo_fun = function(x) {
  x$time = ceiling(x$time / 7) # change time from days to weeks
  x
}
trafo_fun(trgs) # works
#>      time status
#>   1:   44   TRUE
#>   2:   65   TRUE
#>   3:  145  FALSE
#>   4:   30   TRUE
#>   5:  127   TRUE
#>  ---            
#> 224:   27  FALSE
#> 225:   28  FALSE
#> 226:   15  FALSE
#> 227:   25  FALSE
#> 228:   26  FALSE

pout = mlr3pipelines:::PipeOpUpdateTarget$new(param_vals = list(trafo = trafo_fun))
pout$train(list(task)) # doesn't work
#> Error in initialize(...): unused argument (target = c("time", "status"))
#> This happened PipeOp update_target's $train()

Created on 2023-09-05 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant