mlr3
mlr3 copied to clipboard
nicer error message or better default for id in as_task_<xx> when id is not given
as_task_classif(data.frame(x = factor(c("a", "b", "a", "b"), levels = c("a", "b")), y = factor(c("a", "b", "a", "b"), levels = c("a", "b"))), target = "y")
#> Error in .__Task__initialize(self = self, private = private, super = super, :
#> Assertion on 'id' failed: Must have length 1.
this is because id is created from the expression of the data argument. I would vote for creating a nicer, shorter version of the id, possibly incorporating a hash of the entire string, e.g.
data.frame.x...fac.35d82fge
in cases where we can't create the id the straightforward way, but even if not a more informative error message would help