tidymodels / parsnip

A tidy unified interface to models
https://parsnip.tidymodels.org
Other
584 stars 88 forks source link

misleading error re: `fit_xy()` with GAMs #1014

Closed simonpcouch closed 10 months ago

simonpcouch commented 10 months ago

This was referenced in a Community issue previously, but the error resulting from not using a model formula with GAMs is a head-scratcher:

library(tidymodels)

gam_wflow <- 
  workflow() %>%
  add_formula(mpg ~ .) %>%
  add_model(gen_additive_mod("regression")) 

gam_fit <- gam_wflow %>%
  fit(mtcars)
#> Error in `fit_xy()`:
#> ! `fit()` must be used with GAM models (due to its use of formulas).

With tune, as well, it seems to suggest even that GAMs can't be tuned / evaluated across resamples:

gam_res <- fit_resamples(gam_wflow, bootstraps(mtcars))
#> → A | error:   `fit()` must be used with GAM models (due to its use of formulas).
#> There were issues with some computations   A: x25
#> 
#> Warning: All models failed. Run `show_notes(.Last.tune.result)` for more
#> information.

Created on 2023-11-02 with reprex v2.0.2

Related to #770.

github-actions[bot] commented 9 months ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.