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

tuning with outcome level "class" #487

Closed
simonpcouch opened this issue May 3, 2022 · 2 comments
Closed

tuning with outcome level "class" #487

simonpcouch opened this issue May 3, 2022 · 2 comments

Comments

@simonpcouch
Copy link
Contributor

I came across this while writing tests for a fix to tidymodels/stacks#125. It seems like tuning fails when the level of an outcome is "class":

library(tidymodels)

# works okay with class_1 and class_2:
x <- tibble(
  class = sample(c("class_1", "class_2"), 100, replace = TRUE),
  a = rnorm(100),
  b = rnorm(100)
)

res <- tune_grid(
  logistic_reg(engine = 'glmnet', penalty = tune(), mixture = 1),
  preprocessor = recipe(class ~ ., x),
  resamples = vfold_cv(x, 2),
  grid = 2,
  control = control_grid()
)

# fails on outcome with level "class"
x_ <- tibble(
  class = sample(c("class_1", "class"), 100, replace = TRUE),
  a = rnorm(100),
  b = rnorm(100)
)

res_ <- tune_grid(
  logistic_reg(engine = 'glmnet', penalty = tune(), mixture = 1),
  preprocessor = recipe(class ~ ., x_),
  resamples = vfold_cv(x_, 2),
  grid = 2,
  control = control_grid()
)
#> x Fold1: internal: Error:
#> ! In metric: `accuracy`
#> Problem while computing `.estim...
#> x Fold2: internal: Error:
#> ! In metric: `accuracy`
#> Problem while computing `.estim...
#> Warning: All models failed. See the `.notes` column.

Created on 2022-05-03 by the reprex package (v2.0.1)

@simonpcouch
Copy link
Contributor Author

Closed in #720.

@github-actions
Copy link

github-actions bot commented Jun 1, 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 Jun 1, 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

No branches or pull requests

1 participant