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))