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 #853

Merged
merged 23 commits into from
Apr 5, 2024
Merged

add extract_fit_time #853

merged 23 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/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
R/fit.R Outdated
@@ -445,8 +445,14 @@ allow_sparse <- function(x) {
#' @export
print.model_fit <- function(x, ...) {
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
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
@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
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 🤪 )

NEWS.md Outdated Show resolved Hide resolved
R/extract.R Outdated Show resolved Hide resolved
tests/testthat/test-extract.R Outdated Show resolved Hide resolved
Merge branch 'main' into extract_fit_time

# Conflicts:
#	DESCRIPTION
#	NEWS.md
#	R/fit_helpers.R
R/extract.R Outdated Show resolved Hide resolved
tests/testthat/test-extract.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.

🏄 Just one similar docs edits with workflows.

R/extract.R Outdated Show resolved Hide resolved
@EmilHvitfeldt EmilHvitfeldt merged commit fd5124c into main Apr 5, 2024
7 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.

3 participants