I got the error message "Error: For a classification model, the outcome should be a factor." after I use fit_resamples. Then I switched to the fit() function and got the same error. Does anyone know why this is?
rec <- recipe(OFFER_STATUS~., data = train) %>%
update_role(ID, new_role = "ID") %>%
# impute all other numeric columns with their mean
step_impute_mean(all_numeric_predictors()) %>%
# determine what happens when a new nominal value is encountered in test data (which was missing from the training set)
step_novel(all_nominal(), -has_role("ID"), new_level="new") %>%
# impute all other nominal (character + factor) columns with the value "none"
step_unknown(all_nominal(), new_level = "none") %>%
# convert all strings to factors
step_string2factor(all_nominal(), -all_outcomes(), -has_role("ID")) %>%
# remove constant columns
step_zv(all_predictors())
rec %>% prep()
But I got a new error message which is "Error in glm.fit(x = structure(c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, : NA/NaN/Inf in 'x'"
The x argument to the glm.fit function contains one or more values that are missing, not a number or, possibly, entered as infinite. This is usually a problem with missing values.