mlr-org / mlr3

mlr3: Machine Learning in R - next generation
https://mlr3.mlr-org.com
GNU Lesser General Public License v3.0
936 stars 85 forks source link

Save only selected edges in graph learner #968

Open MislavSag opened 1 year ago

MislavSag commented 1 year ago

When we banchmark graph learnes, we can choose to save models or backends or not to save:

  store_models = FALSE,
  store_backends = TRUE,

Is it possible to save only some step in the graph but discard others? For example, if I want to save only features selected in the filter phase, I don't want to save all other steps.

It comes to my mind, I can add saveRRD function somewhere in the pipeline, but maybe you can request some other way?

sebffischer commented 12 months ago

I don't think that this is currently possible. One way to achieve this would be to allow running callbacks in the workhorse function (that runs train and predict). There you could then arbitrarily discard parts of the model. What do you think @mllg?

MislavSag commented 12 months ago

I have add readRDS in my custom pipeline, but I was pretty sure this was not the right way. Also in that way, it was hard to add some metadata (cv, fold, taks etc).

Can you send a link where I can read more on callbacks?

sebffischer commented 12 months ago

So currently it is not yet possible to solve your issue with callbacks and I am waiting for feedback whether we want to enable this here.

We already have the mechanism in place in other areas though, you can read about it here: https://mlr3misc.mlr-org.com/reference/Callback.html

mb706 commented 11 months ago

Sorry for transferring twice. I thought this might be an mlr3pipelines issue, but upon thinking about this, what you really want is something like a store_models = function() option that selects the things you want to keep.