Next to a mutation, I want to transform the target variable through a pipeline.
My orginal graph, I’ve created through the following code:
pomut = po("mutate")
mutations = list(
PM25_01.Trafo = ~ (PM25_01*T_01)
)
pomut$param_set$values$mutation = mutations
preproc_1 = po("select", selector = selector_name(c("T_01", "Hum_01", "PM25_01")), id = "slct_1")
nop_1 = po("nop", id = "nop_1")
nop_2 = po("nop", id = "nop_2")
nop_3 = po("nop", id = "nop_3")
# ---------------------------------------------------------------------------------------------------------
# Regression Graphlearner
# ----------------------------------------------------------------------------------------
graph = preproc_1 %>>%
po("branch", c("lrn_xgboost", "lrn_ranger", "lrn_MLR", "lrn_ridge")) %>>%
gunion(list(nop_1, nop_2, pomut, nop_3)) %>>%
gunion(lapply(c(learners[[1]], learners[[2]], learners[[3]], learners[[4]]), po)) %>>%
po("unbranch")
graph$plot()
If I plot the graph via graph$plot
I get the following figure
I consulted the following resources:
https://mlr-org.com/gallery/pipelines/2020-02-01-tuning-multiplexer/
https://mlr3book.mlr-org.com/chapters/chapter8/non-sequential_pipelines_and_tuning.html
https://mlr3book.mlr-org.com/chapters/chapter8/non-sequential_pipelines_and_tuning.html#sec-pipelines-ppl
and especially this source:
https://mlr-org.com/gallery/pipelines/2020-06-15-target-transformations-via-pipelines/index.html
Using this source and the others, I couldn’t figure out how to implement a target transformation in the code structure of my existing code. There I’ve produced a graph with multiple learners branching out into different data channels.
It seems like I need to use edges, but I couldn’t find any examples, where the edges weren’t just added to an existing graph. Also in the same examples with edges I’ve only seen graphs including only one learner.
Could somebody point me towards the right direction?
Basically I want to adjust the section in my graph with the MLR learner (first figure) adding a target transformation along with a mutation of a feature creating the new feature called PM25_01.Trafo
(see my first code snippet).
I want to add the structure shown in the below figure into my original graph considering also my mutation pomut of course:
Thanks in advance!