Skip to content
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 #1071

Merged
merged 26 commits into from
Apr 5, 2024
Merged

add extract_fit_time #1071

merged 26 commits into from
Apr 5, 2024

Conversation

EmilHvitfeldt
Copy link
Member

@EmilHvitfeldt EmilHvitfeldt commented Dec 16, 2022

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:

  • make sure names are good.
    • right now id clashed with id returned from tune_grid()
  • add tests
  • Make sure this change is backwards compatible
  • remove hardhat from Remotes

Related PRs
tidymodels/hardhat#218
tidymodels/parsnip#853
tidymodels/workflows#191

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()) |>
  prep()

rec_ames |>
  extract_fit_time()
#> # A tibble: 6 × 3
#>   id              part     time
#>   <chr>           <chr>   <dbl>
#> 1 dummy_xmsLC     prep  0.0230 
#> 2 dummy_xmsLC     bake  0.0290 
#> 3 nzv_sUtzk       prep  0.296  
#> 4 nzv_sUtzk       bake  0      
#> 5 normalize_t06mp prep  0.00700
#> 6 normalize_t06mp bake  0.00300

rec_ames |>
  extract_fit_time() |>
  count(id, wt = time, name = "time")
#> # A tibble: 3 × 2
#>   id                time
#>   <chr>            <dbl>
#> 1 dummy_xmsLC     0.0520
#> 2 normalize_t06mp 0.0100
#> 3 nzv_sUtzk       0.296

rec_ames |>
  extract_fit_time() |>
  count(part, wt = time, name = "time")
#> # A tibble: 2 × 2
#>   part    time
#>   <chr>  <dbl>
#> 1 bake  0.0320
#> 2 prep  0.326

@EmilHvitfeldt EmilHvitfeldt marked this pull request as draft December 16, 2022 21:12
@EmilHvitfeldt EmilHvitfeldt marked this pull request as ready for review June 16, 2023 18:49
@topepo
Copy link
Member

topepo commented Jun 26, 2023

Can we have a switch that will do the timing? I'd like to avoid the issue with diffs/reproducibility as we had with parsnip when we were tracking time.

@EmilHvitfeldt
Copy link
Member Author

Can we have a switch that will do the timing? I'd like to avoid the issue with diffs/reproducibility as we had with parsnip when we were tracking time.

You mean an argument that will turn on/off the timing?

NEWS.md Outdated Show resolved Hide resolved
R/extract_fit_time.R Outdated Show resolved Hide resolved
R/recipe.R Outdated Show resolved Hide resolved
Copy link
Contributor

@simonpcouch simonpcouch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

DESCRIPTION Outdated Show resolved Hide resolved
EmilHvitfeldt and others added 2 commits April 5, 2024 14:03
Co-authored-by: Simon P. Couch <simonpatrickcouch@gmail.com>
@EmilHvitfeldt EmilHvitfeldt merged commit 63ced27 into main Apr 5, 2024
9 checks passed
@EmilHvitfeldt EmilHvitfeldt deleted the extract_fit_time branch April 5, 2024 21:38
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants