Closed
Description
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)
Metadata
Metadata
Assignees
Labels
No labels