| learner_gam | R Documentation |
Constructs learner class object for fitting generalized additive models with mgcv::gam.
learner_gam(
formula,
info = "mgcv::gam",
family = gaussian(),
select = FALSE,
gamma = 1,
learner.args = NULL,
...
)
formula |
(formula) Formula specifying response and design matrix. |
info |
(character) Optional information to describe the instantiated learner object. |
family |
This is a family object specifying the distribution and link to use in
fitting etc (see |
select |
If this is |
gamma |
Increase this beyond 1 to produce smoother models. |
learner.args |
(list) Additional arguments to learner$new(). |
... |
Additional arguments to mgcv::gam. |
learner object.
n <- 5e2
x1 <- rnorm(n, sd = 2)
x2 <- rnorm(n)
y <- x1 + cos(x1) + rnorm(n, sd = 0.5**.5)
d0 <- data.frame(y, x1, x2)
lr <- learner_gam(y ~ s(x1) + x2)
lr$estimate(d0)
if (interactive()) {
plot(lr$fit)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.