#| child: aaa.Rmd
#| include: false

r descr_models("bag_mars", "earth")

Tuning Parameters

#| label: earth-param-info
#| echo: false
defaults <- 
  tibble::tibble(parsnip = c("num_terms", "prod_degree", "prune_method"),
                 default = c("see below", "1L", "'backward'"))

param <-
  bag_mars() |> 
  set_engine("earth") |> 
  make_parameter_list(defaults)

This model has r nrow(param) tuning parameters:

#| label: earth-param-list
#| echo: false
#| results: asis
param$item

The default value of num_terms depends on the number of predictor columns. For a data frame x, the default is min(200, max(20, 2 * ncol(x))) + 1 (see [earth::earth()] and the reference below).

Translation from parsnip to the original package (regression)

r uses_extension("bag_mars", "earth", "regression")

#| label: earth-reg
bag_mars(num_terms = integer(1), prod_degree = integer(1), prune_method = character(1)) |> 
  set_engine("earth") |> 
  set_mode("regression") |> 
  translate()

Translation from parsnip to the original package (classification)

r uses_extension("bag_mars", "earth", "classification")

#| label: earth-cls
library(baguette)

bag_mars(
  num_terms = integer(1),
  prod_degree = integer(1),
  prune_method = character(1)
) |> 
  set_engine("earth") |> 
  set_mode("classification") |> 
  translate()

Preprocessing requirements

#| child: template-makes-dummies.Rmd

Case weights

#| child: template-uses-case-weights.Rmd

Note that the earth package documentation has: "In the current implementation, building models with weights can be slow."

References



Try the parsnip package in your browser

Any scripts or data that you put into this service are public.

parsnip documentation built on June 8, 2025, 12:10 p.m.