| learner_mars | R Documentation |
Constructs a learner class object for fitting multivariate adaptive regression splines with earth::earth.
learner_mars(
formula,
info = "earth::earth",
degree = 1,
nprune = NULL,
glm = NULL,
learner.args = NULL,
...
)
formula |
(formula) Formula specifying response and design matrix. |
info |
(character) Optional information to describe the instantiated learner object. |
degree |
Maximum degree of interaction (Friedman's |
nprune |
Maximum number of terms (including intercept) in the pruned model.
Default is NULL, meaning all terms created by the forward pass
(but typically not all terms will remain after pruning).
Use this to enforce an upper bound on the model size (that is less than |
glm |
NULL (default) or a list of arguments to pass on to |
learner.args |
(list) Additional arguments to learner$new(). |
... |
Additional arguments to earth::earth. |
learner object.
# poisson regression
n <- 5e2
x <- rnorm(n)
w <- 50 + rexp(n, rate = 1 / 5)
y <- rpois(n, exp(2 + 0.5 * x + log(w)) * rgamma(n, 1 / 2, 1 / 2))
d0 <- data.frame(y, x, w)
lr <- learner_mars(y ~ x + offset(log(w)), degree = 2,
glm = list(family = poisson())
)
lr$estimate(d0)
lr$predict(data.frame(x = 0, w = c(1, 2)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.