Skip to content

add extract_fit_time#853

Merged
EmilHvitfeldt merged 23 commits intomainfrom
extract_fit_time
Apr 5, 2024
Merged

add extract_fit_time#853
EmilHvitfeldt merged 23 commits intomainfrom
extract_fit_time

Conversation

@EmilHvitfeldt
Copy link
Copy Markdown
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/recipes#1071
tidymodels/workflows#191

library(tidymodels)

lm_spec <- linear_reg()
lm_fit <- fit(lm_spec, mpg ~ ., data = mtcars)

extract_fit_time(lm_fit)
#> # A tibble: 1 × 3
#>   id         part     time
#>   <chr>      <chr>   <dbl>
#> 1 linear_reg fit   0.00200

@EmilHvitfeldt EmilHvitfeldt marked this pull request as draft December 16, 2022 21:17
Comment thread R/fit.R Outdated
cat("parsnip model object\n\n")
if (!is.na(x$elapsed[["elapsed"]])) {
cat("Fit time: ", prettyunits::pretty_sec(x$elapsed[["elapsed"]]), "\n")
if (is.null(x$elapsed$print)) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm sure this can be rewritten better. If we go ahead with these functions then I'll clean it

Merge commit 'a85e5083de0d1ec8087678cf21580690a37da81b'

#Conflicts:
#	DESCRIPTION
Comment thread R/extract.R
@EmilHvitfeldt EmilHvitfeldt marked this pull request as ready for review June 16, 2023 18:45
@EmilHvitfeldt EmilHvitfeldt requested a review from hfrick June 16, 2023 20:01
Copy link
Copy Markdown
Member

@hfrick hfrick left a comment

Choose a reason for hiding this comment

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

One comment on naming things (time of all things 🤪 )

Comment thread NEWS.md Outdated
Comment thread R/extract.R Outdated
Comment thread tests/testthat/test-extract.R Outdated
Merge branch 'main' into extract_fit_time

# Conflicts:
#	DESCRIPTION
#	NEWS.md
#	R/fit_helpers.R
Comment thread R/extract.R Outdated
Comment thread tests/testthat/test-extract.R Outdated
Copy link
Copy Markdown
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.

🏄 Just one similar docs edits with workflows.

Comment thread R/extract.R Outdated
EmilHvitfeldt and others added 3 commits April 5, 2024 14:03
Co-authored-by: Simon P. Couch <simonpatrickcouch@gmail.com>
@EmilHvitfeldt EmilHvitfeldt merged commit fd5124c into main Apr 5, 2024
@EmilHvitfeldt EmilHvitfeldt deleted the extract_fit_time branch April 5, 2024 21:38
@github-actions
Copy link
Copy Markdown
Contributor

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.

3 participants