brulee_logistic_reg() expected 'mixture' to be a double.

I tried using tidymodels and grid to tune brulee logistic regression and it gave me error that expeced "mixture" tuning to be a double. But if I do hyper_log_grid$mixture %>% class() its output is 'numeric'. Numeric implies double right? Man, I even added %>% as.double() at the input.

Here's my code:

wf_brulee <-
  workflow() %>% 
  add_recipe(X_rec) %>% 
  add_model(brulee_spec)

grid_ctrl <-
   control_grid(
      save_pred = TRUE,
      parallel_over = "everything",
      save_workflow = TRUE
   )

hyper_log_grid <- grid_latin_hypercube(
  penalty(),
  mixture(range = as.double(c(0.0,1.0))),
  original = T,
  size = 10
)

grid_brulee_hyper <- 
  wf_brulee %>% 
  tune_grid(
    resamples = X_folds,
    grid = hyper_log_grid,
    control = grid_ctrl
  )

grid_brulee_hyper %>% 
  show_best(metric = "roc_auc")

Here's the error:

collect_notes(x = grid_brulee_hyper) %>% 
  pull(note)
[1] "\033[1m\033[33mError\033[39m in \033[38;5;254m`check_double()`\033[39m:\033[22m\n\033[33m!\033[39m brulee_logistic_reg() expected 'mixture' to be a double."
  [2] "\033[1m\033[33mError\033[39m in \033[38;5;254m`check_double()`\033[39m:\033[22m\n\033[33m!\033[39m brulee_logistic_reg() expected 'mixture' to be a double."
  [3] "\033[1m\033[33mError\033[39m in \033[38;5;254m`check_double()`\033[39m:\033[22m\n\033[33m!\033[39m brulee_logistic_reg() expected 'mixture' to be a double."
  [4] "\033[1m\033[33mError\033[39m in \033[38;5;254m`check_double()`\033[39m:\033[22m\n\033[33m!\033[39m brulee_logistic_reg() expected 'mixture' to be a double."

Thanks for the post!

It's difficult to troubleshoot here without a reproducible example, though a couple things that come to mind:

  • We've just recently put out new releases of parsnip and brulee—do you have parsnip 1.0.2 and brulee 0.2.0 installed?
  • Does this work as expected with allow_par = FALSE in control_grid()?
  • Does the error persist if you set grid = 10 as opposed to specifying the latin hypercube design yourself?

If this doesn't do the trick, here's some code to get you started with a reproducible example:

library(tidymodels)
library(brulee)

head(two_class_dat)

brulee_spec <- 
  logistic_reg(penalty = tune(), mixture = tune()) %>%
  set_engine("brulee")

X_rec <- recipe(Class ~ ., data = two_class_dat)

X_folds <- bootstraps(two_class_dat, 10)

wf_brulee <-
  workflow() %>% 
  add_recipe(X_rec) %>% 
  add_model(brulee_spec)

grid_ctrl <-
  control_grid(
    save_pred = TRUE,
    parallel_over = "everything",
    save_workflow = TRUE
  )

hyper_log_grid <- grid_latin_hypercube(
  penalty(),
  mixture(range = as.double(c(0.0,1.0))),
  original = T,
  size = 10
)

grid_brulee_hyper <- 
  wf_brulee %>% 
  tune_grid(
    resamples = X_folds,
    grid = hyper_log_grid,
    control = grid_ctrl
  )

grid_brulee_hyper %>% 
  show_best(metric = "roc_auc")

Hi simoncouch, thanks for the reply.

I didn't have the chance to apply the allow_par = FALSE, but I vaguely remember that I was still getting error with grid = 10. But don't take my words for it, since I decided to ditch the brulee logistic regression for C.50 decision tree.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.