-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add extract_fit_time #191
add extract_fit_time #191
Conversation
Merge commit '882b06bb27592055493b10065b3ee805399fad38' #Conflicts: # DESCRIPTION
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the interface is super solid, and the potential uses for this in stacks, workflow sets, and tuning results are many!
Just made a few small docs suggestions—I think, as often as we can, we should use the same term to refer to this value. I think "elapsed fit time" is a good cue, in that it self-documents system.time()$elapsed
and aligns with the function names. :)
Pending those TODO's, thumbs up from me!
Co-authored-by: Simon P. Couch <[email protected]>
re:
workflowsets uses I'm not sure I have any silver bullet recommendations. This may be a separate issue from naming, but there may also be some natural linkage to |
I like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if stage_id
is a good alternative to process_id
?
Merge branch 'main' into extract_fit_time # Conflicts: # DESCRIPTION
I think a part of this interface that's been tough to wrap my head around is the degree of summarization. I have a hunch that getting summarization right will make deciding on column names a bit easier. At the moment, output looks like: library(tidymodels)
data(ames, package = "modeldata")
rec_ames <-
recipe(Sale_Price ~ ., data = ames) |>
step_dummy(all_nominal_predictors()) |>
step_nzv(all_predictors()) |>
step_normalize(all_predictors())
lm_spec <- linear_reg()
wf_fit <- fit(workflow(rec_ames, lm_spec), ames)
wf_fit2 <- fit(workflow(Sale_Price ~ ., lm_spec), ames)
extract_fit_time(wf_fit)
#> # A tibble: 1 × 3
#> stage process_id time
#> <chr> <chr> <dbl>
#> 1 workflow workflow 0.419
extract_fit_time(wf_fit, summarize = FALSE)
#> # A tibble: 7 × 3
#> stage process_id time
#> <chr> <chr> <dbl>
#> 1 preprocess prep.dummy_wjSqo 0.0290
#> 2 preprocess bake.dummy_wjSqo 0.156
#> 3 preprocess prep.nzv_lUZwC 0.199
#> 4 preprocess bake.nzv_lUZwC 0
#> 5 preprocess prep.normalize_I9sdp 0.00400
#> 6 preprocess bake.normalize_I9sdp 0.00300
#> 7 model linear_reg 0.0280
extract_fit_time(wf_fit2)
#> # A tibble: 1 × 3
#> stage process_id time
#> <chr> <chr> <dbl>
#> 1 workflow workflow 0.173
extract_fit_time(wf_fit2, summarize = FALSE)
#> # A tibble: 1 × 3
#> stage process_id time
#> <chr> <chr> <dbl>
#> 1 model linear_reg 0.173 With a recipe, the Workflows already have the built-in unit ("stage") extract_fit_time(wf_fit, summarize = FALSE) %>%
group_by(stage) %>%
summarize(time = sum(time))
#> # A tibble: 2 × 2
#> stage time
#> <chr> <dbl>
#> 1 model 0.0280
#> 2 preprocess 0.392 It'd be nice if that was the default. An argument like Created on 2024-03-27 with reprex v2.1.0 |
The other remaining question for me is whether we should be thinking of some functionality that measures predict elapsed time alongside this. My general leaning is that since 1) the current methods can point out when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking solid. :) Just one docs clarification.
Co-authored-by: Simon P. Couch <[email protected]>
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
This is part of a series of PRs to add a new generic
extract_fit_time()
to allow users to investigate how long different tidymodels objects takes to fit.TODO:
id
clashed withid
returned fromtune_grid()
Related PRs
tidymodels/hardhat#218
tidymodels/recipes#1071
tidymodels/parsnip#853
Created on 2023-06-15 with reprex v2.0.2