For this engine, there are multiple modes: classification and regression
This model has 3 tuning parameters:
num_terms
: # Model Terms (type: integer, default: see below)
prod_degree
: Degree of Interaction (type: integer, default: 1L)
prune_method
: Pruning Method (type: character, default: 'backward')
Parsnip changes the default range for num_terms
to c(50, 500)
.
mars(num_terms = integer(1), prod_degree = integer(1), prune_method = character(1)) %>%
set_engine("earth") %>%
set_mode("regression") %>%
translate()
## MARS Model Specification (regression)
##
## Main Arguments:
## num_terms = integer(1)
## prod_degree = integer(1)
## prune_method = character(1)
##
## Computational engine: earth
##
## Model fit template:
## earth::earth(formula = missing_arg(), data = missing_arg(), weights = missing_arg(),
## nprune = integer(1), degree = integer(1), pmethod = character(1),
## keepxy = TRUE)
mars(num_terms = integer(1), prod_degree = integer(1), prune_method = character(1)) %>%
set_engine("earth") %>%
set_mode("classification") %>%
translate()
## MARS Model Specification (classification)
##
## Main Arguments:
## num_terms = integer(1)
## prod_degree = integer(1)
## prune_method = character(1)
##
## Engine-Specific Arguments:
## glm = list(family = stats::binomial)
##
## Computational engine: earth
##
## Model fit template:
## earth::earth(formula = missing_arg(), data = missing_arg(), weights = missing_arg(),
## nprune = integer(1), degree = integer(1), pmethod = character(1),
## glm = list(family = stats::binomial), keepxy = TRUE)
An alternate method for using MARs for categorical outcomes can be found in [discrim_flexible()].
Factor/categorical predictors need to be converted to numeric values (e.g., dummy or indicator variables) for this engine. When using the formula method via \code{\link[=fit.model_spec]{fit()}}, parsnip will convert factor columns to indicators.
This model can utilize case weights during model fitting. To use them, see the documentation in [case_weights] and the examples on tidymodels.org
.
The fit()
and fit_xy()
arguments have arguments called case_weights
that expect vectors of case weights.
Note that the earth
package documentation has: "In the current implementation, building models with weights can be slow."
This model object contains data that are not required to make predictions. When saving the model for the purpose of prediction, the size of the saved object might be substantially reduced by using functions from the butcher package.
The "Fitting and Predicting with parsnip" article contains examples for mars()
with the "earth"
engine.
Friedman, J. 1991. "Multivariate Adaptive Regression Splines." The Annals of Statistics, vol. 19, no. 1, pp. 1-67.
Milborrow, S. "Notes on the earth package."
Kuhn, M, and K Johnson. 2013. Applied Predictive Modeling. Springer.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.