r descr_models("gen_additive_mod", "mgcv")
defaults <- tibble::tibble(parsnip = c("select_features", "adjust_deg_free"), default = c("FALSE", "1.0")) param <- gen_additive_mod() %>% set_engine("mgcv") %>% make_parameter_list(defaults)
This model has r nrow(param)
tuning parameters:
param$item
gen_additive_mod(adjust_deg_free = numeric(1), select_features = logical(1)) %>% set_engine("mgcv") %>% set_mode("regression") %>% translate()
gen_additive_mod(adjust_deg_free = numeric(1), select_features = logical(1)) %>% set_engine("mgcv") %>% set_mode("classification") %>% translate()
This model should be used with a model formula so that smooth terms can be specified. For example:
library(mgcv)
library(mgcv) gen_additive_mod() %>% set_engine("mgcv") %>% set_mode("regression") %>% fit(mpg ~ wt + gear + cyl + s(disp, k = 10), data = mtcars)
The smoothness of the terms will need to be manually specified (e.g., using s(x, df = 10)
) in the formula. Tuning can be accomplished using the adjust_deg_free
parameter.
When using a workflow, pass the model formula to [workflows::add_model()]'s formula
argument, and a simplified preprocessing formula elsewhere.
spec <- gen_additive_mod() %>% set_engine("mgcv") %>% set_mode("regression") workflow() %>% add_model(spec, formula = mpg ~ wt + gear + cyl + s(disp, k = 10)) %>% add_formula(mpg ~ wt + gear + cyl + disp) %>% fit(data = mtcars) %>% extract_fit_engine()
To learn more about the differences between these formulas, see [?model_formula
][parsnip::model_formula].
Ross, W. 2021. Generalized Additive Models in R: A Free, Interactive Course using mgcv
Wood, S. 2017. Generalized Additive Models: An Introduction with R. Chapman and Hall/CRC.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.