"all models failed" in tidymodels

I keep getting the following error when attempting to tune an xgboost model for multiclass classification with 7 different classes in tidymodels using the tune_bayes() function:

Error in `estimate_tune_results()`:
! All of the models failed. See the .notes column.
Run `rlang::last_error()` to see where the error occurred.
Warning message:
All models failed. See the `.notes` column.

Code:

set.seed(123)
swing_split <- initial_split(swing_data, strata = outcome)
swing_train <- training(swing_split)
swing_test <- testing(swing_split)
head(swing_train, n = 15)

 A tibble: 15 x 7
   outcome plate_x plate_z pfx_x pfx_z release_speed stand
   <fct>     <dbl>   <dbl> <dbl> <dbl>         <dbl> <fct>
 1 foul       0.19    1.89  0.36 -0.31          85.5 R    
 2 foul      -0.16    2.95 -0.73  1.52          92.6 L    
 3 foul       0.43    2.1   0.99 -1.64          79.6 L    
 4 foul      -0.35    2.74 -0.61  1.51          91.7 R    
 5 foul      -1.09    2.69 -1.2   1.46          93.1 R    
 6 foul       0.86    2.8   1.09  0.29          79.9 L    
 7 foul      -0.33    2.59  1.22  1.2           95.7 L    
 8 foul      -0.39    2.31 -0.12 -0.46          78.5 R    
 9 foul       0.17    1.77  1.53  0.59          85.9 R    
10 foul       0.17    3.54 -0.54  1.58          96.2 R    
11 foul      -0.69    3.01  0.96  1.57          94.7 L    
12 foul       0.82    1.97  1.07 -0.62          79.7 L    
13 foul       0.89    2.87  1.5   0.61          92.3 L    
14 foul      -0.07    1.5   1.46  0.55          81.8 L    
15 foul      -0.09    3.63 -0.57  1.37          91.1 L


set.seed(234)
swing_folds <- vfold_cv(swing_train, strata = outcome)

swing_rec <-
  recipe(outcome ~ ., data = swing_train) %>%
  step_dummy(stand, one_hot = T)

xgb_spec <- boost_tree(
  trees = 175, 
  tree_depth = tune(), min_n = tune(), 
  loss_reduction = tune(),                     
  sample_size = tune(), mtry = finalize(mtry(), swing_train),         
  learn_rate = 0.1) %>% 
  set_engine("xgboost", objective = "multi:softprob", num_class = 7) %>% 
  set_mode("classification")
swing_wf <- workflow(swing_rec, xgb_spec)

xgb_set <- extract_parameter_set_dials(swing_wf)

doParallel::registerDoParallel()
set.seed(345)
xgb_tune <- swing_wf %>% 
  tune_bayes(
    iter = 25,
    resamples = swing_folds, 
    param_info = xgb_set,
    metrics = metric_set(accuracy), 
    initial = 10,
    control = control_bayes(parallel_over = "everything", save_pred = T, verbose = T))

I have looked on the internet and tried a couple of things, but I continue to get that error.

Anything interesting in the .notes column?

It just repeated the error in the .notes column, and I also tried running the process not in parallel because that seemed to be something that people who also had this problem tried, but I still got the same error.

Thanks for providing code , but you could take further steps to make it more convenient for other forum users to help you.

Share some representative data that will enable your code to run and show the problematic behaviour.

You might use tools such as the library datapasta, or the base function dput() to share a portion of data in code form, i.e. that can be copied from forum and pasted to R session.

Reprex Guide

Recent versions of tune has a collect_notes() function that make it easier to read them. That output would help.

In the meantime, try removing the option initial = 10 as well as the engine arguments. We set that/those values as the default and you might be passing them twice.

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.