I can't use graphs in clustering tasks because as_learner(graph_object)
won't work for clustering learners:
Here's a reprex:
# metapackage
library(mlr3verse)
# task creation
task = TaskClust$new(
id = "cars",
backend = subset(
mtcars,
select = c(
mpg,
cyl,
hp
)
)
)
# learner
learner = lrn("clust.kmeans")
# graph
graph = po("scale") %>>%
po("learner", learner)
# convert graph to learner
glrn = as_learner(graph)
#> Error in .__GraphLearner__initialize(self = self, private = private, super = super, : 'graph' output type not 'Prediction' (or compatible with it)
Is there a workaround?
Obs.: I can train and predict without converting to learner, but I can't benchmark.