setup_MARS: Setup MARS Hyperparameters

View source: R/070_Hyperparameters.R

setup_MARSR Documentation

Setup MARS Hyperparameters

Description

Setup hyperparameters for Multivariate Adaptive Regression Splines training.

Usage

setup_MARS(
  degree = 1L,
  penalty = NULL,
  nk = NULL,
  nprune = NULL,
  thresh = 0.001,
  minspan = 0L,
  endspan = 0L,
  newvar_penalty = 0,
  fast_k = 20L,
  pmethod = "backward",
  nfold = 0L,
  ncross = 1L,
  stratify = TRUE,
  fast_beta = 1,
  ifw = FALSE
)

Arguments

degree

(Tunable) Integer [1, Inf): Maximum degree of interaction. 1 builds an additive model with no interaction terms.

penalty

(Tunable) Optional Numeric [-1, Inf): Generalized Cross Validation penalty per knot. NULL uses 3 when degree is greater than 1 and 2 otherwise.

nk

(Tunable) Optional Integer [1, Inf): Maximum number of terms, including the intercept, created by the forward pass. NULL lets earth derive it from the number of features.

nprune

(Tunable) Optional Integer [1, Inf): Maximum number of terms, including the intercept, retained after pruning. NULL places no cap on the terms retained, which pruning still selects by pmethod.

thresh

(Tunable) Numeric [0, 1): Forward pass stopping threshold: stop once adding a term changes R-squared by less than this.

minspan

(Tunable) Integer (-Inf, Inf): Minimum number of observations between knots. 0 derives the value internally, and a negative value instead sets the maximum number of equally spaced knots per feature.

endspan

(Tunable) Integer [0, Inf): Minimum number of observations before the first and after the final knot. 0 derives the value internally.

newvar_penalty

(Tunable) Numeric [0, Inf): Penalty for adding a feature not already in the model during the forward pass.

fast_k

(Tunable) Integer [0, Inf): Maximum number of parent terms considered at each step of the forward pass. 0 disables Fast MARS.

pmethod

Character {"backward", "none", "exhaustive", "forward", "seqrep", "cv"}: Pruning method. "cv" requires nfold. Multiclass classification allows only "backward" and "none".

nfold

Integer [0, Inf): Number of cross-validation folds used to estimate out-of-fold R-squared. 0 disables cross-validation.

ncross

Integer [1, Inf): Number of times the nfold cross-validation is repeated.

stratify

Logical: If TRUE, stratify the cross-validation folds on the outcome.

fast_beta

Numeric [0, 1]: Fast MARS aging coefficient.

ifw

(Tunable) Logical: If TRUE, use Inverse Frequency Weighting in classification.

Details

Get more information from earth::earth.

get_varimp() returns earth's three importance criteria, in this order: importance (the GCV criterion), rss (the RSS criterion), and subset_proportion (the fraction of pruning subsets that retain the feature). See varimp_super in train_MARS.R for how each is derived.

Value

MARSHyperparameters object.

Author(s)

EDG

Examples

mars_hyperparams <- setup_MARS(degree = 2L, nprune = 10L)
mars_hyperparams

rtemis documentation built on Oct. 20, 2026, 1:06 a.m.