Skip to content

Q: Do workflow sets require bundling? #73

Description

@3styleJam

I have performed a tuning process on a workflow set containing four workflows, which has taken 3-4 hours to complete. Because of the long processing time, I would like to save the completed workflow set so that it can be reloaded into a future R session without having to run the tuning again.

I tried to bundle the workflow set and save it using saveRDS(workflow_set), however it would not work. Unfortunately I didn't save the error message, but I'm pretty sure it said that I had to select one combination of tuning parameters for each of the four workflows, then I was allowed to bundle and save them individually. This is not ideal as I would like to perform some analysis/create visualisations of the tuning process, and for this I need to have all combinations of tuning parameters and the corresponding metrics.

The question is do I need to bundle the complete workflow set, or is it sufficient to simply call saveRDS(workflow_set)?

Activity

  1. simonpcouch commented on May 27, 2025

    @simonpcouch
    Collaborator

    If the fitted workflow set contains any workflows that would require bundling themselves (xgboost, h2o, bart, etc), then it would need to be bundled before saving. This isn't currently supported by the package.

    I think this method could work by just mapping swap_element over the fitted workflows and then the same function over them on reload; could probably look a lot like the workflow method itself.

    cc @hfrick, the workflowsets maintainer :)

  2. 3styleJam commented on May 28, 2025

    @3styleJam
    Author

    If the fitted workflow set contains any workflows that would require bundling themselves (xgboost, h2o, bart, etc), then it would need to be bundled before saving. This isn't currently supported by the package.

    I think this method could work by just mapping swap_element over the fitted workflows and then the same function over them on reload; could probably look a lot like the workflow method itself.

    cc @hfrick, the workflowsets maintainer :)

    Thanks @simonpcouch. My workflow set does contain xgboost. Perhaps I could build a loop through the workflow set to select each individual combination of parameters in turn, bundle and save? Then I'd have a folder of all the bundled workflows, but then reading that back into a new R session and recreating the workflow set I imagine will not maintain the original referencing?

  3. 3styleJam commented on Jul 1, 2025

    @3styleJam
    Author

    I have a new but related problem where I have unbundled the results of my tuning process into a new script. I have selected one combination of tuning parameters and I want to rebuild the workflow with these new parameters and an unbundled recipe e.g.:

    best_model <- boost_tree(
      tree_depth = best_tree_depth_var,
      learn_rate = best_learn_rate_var,
      ...
      ) |>
        set_mode("classification") |> 
        set_engine("xgboost")
    
    best_workflow <- 
      workflow() |>
      add_model(best_model) |>
      add_recipe(unbundled_recipe)

    This works, however when I call fit(best_workflow, unbundled_training_set), an error is called early at a step of the preprocessing recipe which "could not find function "all_nominal_predictors"". I have checked that the package recipes is loaded in, and I still get this error. Please can you advise on how to fix @simonpcouch ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions