mlr-org / mlr3pipelines

Dataflow Programming for Machine Learning in R
https://mlr3pipelines.mlr-org.com/
GNU Lesser General Public License v3.0
137 stars 25 forks source link

deep cloning of objects in ppls #532

Closed sumny closed 2 years ago

sumny commented 3 years ago

Should all Learner objects etc. in ppls be deep clones of the input arguments? e.g., https://github.com/mlr-org/mlr3pipelines/blob/e0591244b83b0f1c02dc160b02cf8adad0dacd34/R/mlr_graphs_elements.R#L225

mb706 commented 3 years ago

I would say the input arguments should be (1) not modified by reference in the ppl function, and (2) should not have any common references with the output object. However, many operators (gunion, %>>%) already clones things, so if all we are doing with graphs is to gunion them here this particular case is not a problem I think. If you find other cases in ppl where arguments do get modified by reference then this should probably be fixed...