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

Feature request: collect_notes #363

Closed
EmilHvitfeldt opened this issue Mar 29, 2021 · 4 comments
Closed

Feature request: collect_notes #363

EmilHvitfeldt opened this issue Mar 29, 2021 · 4 comments
Labels
feature a feature request or enhancement

Comments

@EmilHvitfeldt
Copy link
Member

What it says in the title. A function to collect all the errors in a fast and easy way.

basic prototype

collect_notes <- function(x) {
  x$.notes %>%
  bind_rows()
}
library(tidymodels)
set.seed(6735)
mtcars1 <- mtcars
mtcars1$disp <- "no value"

folds <- vfold_cv(mtcars1, v = 5)

spline_rec <- recipe(mpg ~ ., data = mtcars1) %>%
  step_ns(disp) %>%
  step_ns(wt)

lin_mod <- linear_reg() %>%
  set_engine("lm")

control <- control_resamples(save_pred = TRUE)

spline_res <- fit_resamples(lin_mod, spline_rec, folds, control = control)
#> x Fold1: preprocessor 1/1: Error: All columns selected for the step should be num...
#> x Fold2: preprocessor 1/1: Error: All columns selected for the step should be num...
#> x Fold3: preprocessor 1/1: Error: All columns selected for the step should be num...
#> x Fold4: preprocessor 1/1: Error: All columns selected for the step should be num...
#> x Fold5: preprocessor 1/1: Error: All columns selected for the step should be num...
#> Warning: All models failed. See the `.notes` column.

collect_notes <- function(x) {
  x$.notes %>%
  bind_rows()
}

spline_res %>%
  collect_notes()
#> # A tibble: 5 x 1
#>   .notes                                                                      
#>   <chr>                                                                       
#> 1 preprocessor 1/1: Error: All columns selected for the step should be numeric
#> 2 preprocessor 1/1: Error: All columns selected for the step should be numeric
#> 3 preprocessor 1/1: Error: All columns selected for the step should be numeric
#> 4 preprocessor 1/1: Error: All columns selected for the step should be numeric
#> 5 preprocessor 1/1: Error: All columns selected for the step should be numeric

Created on 2021-03-28 by the reprex package (v0.3.0)

@topepo
Copy link
Member

topepo commented Mar 29, 2021

That would be great. We might also want to add the resampling id's too.

@topepo topepo added the feature a feature request or enhancement label Mar 29, 2021
@EmilHvitfeldt
Copy link
Member Author

Can I take a stab at this?

topepo added a commit that referenced this issue Oct 4, 2021
@EmilHvitfeldt
Copy link
Member Author

closed in #418

@github-actions
Copy link

github-actions bot commented Mar 5, 2022

This issue 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 Mar 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants