Location 3 doesn't exists.

Hi guys, I'm using stacks for the first time and I'm encountering errors that I don't understand. Everything is fine up to the point I try to predict something with the stack model.

Error: Can't subset columns that don't exist. x Location 3 doesn't exist. i There are only 2 columns.

The code chunk is below.

stack_model <- stacks() %>% 
  add_candidates(xgb_res) %>% 
  add_candidates(cat_res) %>% 
  add_candidates(log_res) 

stack_weights <- stack_model %>% blend_predictions()

final_stack <- stack_weights %>% fit_members()

stack_pred <- predict(final_stack, new_data = test, type = 'prob') %>% 
  bind_cols(test) %>% mutate(.pred_class = ifelse(.pred_0 > 0.5, 0, 1)) %>% 
  mutate(.pred_class = as.factor(.pred_class)) 

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.