mlr-org / mlr3pipelines

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

Replace Sugraph #538

Open mb706 opened 4 years ago

mb706 commented 4 years ago

A potentially useful operation on a Graph would be to replace a PipeOp, or an entire subgraph, with a different Graph. With this, one could "edit" the result of a ppl() call, for example, if the pipeline happens to have a single / very few pipeops that are different than what would be desired. Currenlty the user would have to edit the connection table to do this, which may be a bit tedious.

Suggested UI for this would be Graph$replace_subgraph(ids, substitute), substitute being something that can be turned into a graph using as_graph. The operation would remove ids from the graph, and do the equivalent of <channels into ids> %>>% substitute %>>% <channels out of ids> inside the graph (This would entail automatic one-to-many and vararg channel handling, as well as type checking).

mb706 commented 3 years ago

Which (newly free) output channels to connect to new graph, and in what order?

mb706 commented 3 years ago

we want a complementary function that gives us the IDs of all pipeops that are "between" two (or more) pipeops.

mb706 commented 3 years ago

edge cases to watch out for: entire graph, beginning of graph, end of graph

mb706 commented 3 years ago

vararg will be difficult...

mb706 commented 3 years ago

should work the same as %>>% I would say

mb706 commented 3 years ago

Also $remove_pipeop() which removes edges and updates param_set