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

check outcome class conditional on whether y is atomic #835

Merged
merged 2 commits into from
Nov 1, 2022

Conversation

simonpcouch
Copy link
Contributor

😮

With CRAN parsnip:

library(tidymodels)

set.seed(1)
dat <- tibble(x = rnorm(1e7), y = x + rnorm(1e7, sd = .2))

system.time({
  linear_reg() %>%
    fit(y ~ x, dat)
})
#>    user  system elapsed 
#>   4.108   0.158   4.267

Created on 2022-10-28 with reprex v2.0.2

With this PR:

library(tidymodels)

set.seed(1)
dat <- tibble(x = rnorm(1e7), y = x + rnorm(1e7, sd = .2))

system.time({
  linear_reg() %>%
    fit(y ~ x, dat)
})
#>    user  system elapsed 
#>   1.251   0.187   1.442

Created on 2022-10-28 with reprex v2.0.2

Closes #834.

check_outcome is a bit conditional-heavy, though I have trouble imagining how these could be converted to switch- or tibbled-based logic elegantly.

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.

Such a speed-up, nice! 🏎️

R/misc.R Outdated Show resolved Hide resolved
R/misc.R Outdated Show resolved Hide resolved
R/misc.R Outdated Show resolved Hide resolved
@simonpcouch simonpcouch merged commit 933deb2 into main Nov 1, 2022
@simonpcouch simonpcouch deleted the outcome-834 branch November 1, 2022 18:54
@github-actions
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 Nov 16, 2022
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.

Make check_outcome() faster
2 participants