Not all engines are available for all modes of a model. It would be nice if an unavailable combination of mode+engine would throw an informative error.
Currently, you can specify such an incorrect combination (the order of set_engine() and set_mode() doesn't matter) and then fit() errors with a message that doesn't refer to the mode+engine combination.
library(parsnip)
data(mtcars)
# engine C5.0 is only available for classification
# neither of the two specifications error
dt_reg_spec <- decision_tree() %>%
set_mode("regression") %>%
set_engine("C5.0")
dt_reg_spec <- decision_tree() %>%
set_engine("C5.0") %>%
set_mode("regression")
# fit() errors but the message doesn't point to the actual problem
dt_reg_spec %>% fit(mpg ~ ., data = mtcars)
#> Error: formula_ is unknown.
Created on 2021-07-14 by the reprex package (v2.0.0)
Not all engines are available for all modes of a model. It would be nice if an unavailable combination of mode+engine would throw an informative error.
Currently, you can specify such an incorrect combination (the order of
set_engine()andset_mode()doesn't matter) and thenfit()errors with a message that doesn't refer to the mode+engine combination.Created on 2021-07-14 by the reprex package (v2.0.0)