Skip to content

misleading error re: fit_xy() with GAMs #1014

Closed
@simonpcouch

Description

@simonpcouch

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions