Skip to contents

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 keeps every term the forward pass created.

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.

Value

MARSHyperparameters object.

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.

Author

EDG

Examples

mars_hyperparams <- setup_MARS(degree = 2L, nprune = 10L)
mars_hyperparams
#> <MARSHyperparameters>
#>         hyperparameters: 
#>                                  degree: <int> 2
#>                                 penalty: <NUL> NULL
#>                                      nk: <NUL> NULL
#>                                  nprune: <int> 10
#>                                  thresh: <nmr> 1e-03
#>                                 minspan: <int> 0
#>                                 endspan: <int> 0
#>                          newvar_penalty: <nmr> 0.00
#>                                  fast_k: <int> 20
#>                                 pmethod: <chr> backward
#>                                   nfold: <int> 0
#>                                  ncross: <int> 1
#>                                stratify: <lgc> TRUE
#>                               fast_beta: <nmr> 1.00
#>                                     ifw: <lgc> FALSE
#> tunable_hyperparameters: <chr> degree, penalty, nk, nprune, thresh, minspan, endspan, newvar_penalty, fast_k, ifw
#>   fixed_hyperparameters: <chr> pmethod, nfold, ncross, stratify, fast_beta
#>                   tuned: <int> -1
#>               resampled: <int> 0
#>               n_workers: <int> 1
#> 
#>   No search values defined for tunable hyperparameters.