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

r descr_models("bag_tree", "rpart")

Tuning Parameters

#| label: rpart-param-info
#| echo: false
defaults <- 
  tibble::tibble(parsnip = c("tree_depth", "min_n", "cost_complexity", "class_cost"),
                 default = c("30L", "2L", "0.01", "(see below)"))

param <-
 bag_tree() |> 
  set_engine("rpart") |> 
  set_mode("regression") |> 
  make_parameter_list(defaults)

This model has r nrow(param) tuning parameters:

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

For the class_cost parameter, the value can be a non-negative scalar for a class cost (where a cost of 1 means no extra cost). This is useful for when the first level of the outcome factor is the minority class. If this is not the case, values between zero and one can be used to bias to the second level of the factor.

Translation from parsnip to the original package (classification)

r uses_extension("bag_tree", "rpart", "classification")

#| label: rpart-cls
library(baguette)

bag_tree(tree_depth = integer(1), min_n = integer(1), cost_complexity = double(1)) |> 
  set_engine("rpart") |> 
  set_mode("classification") |> 
  translate()

Translation from parsnip to the original package (regression)

r uses_extension("bag_tree", "rpart", "regression")

#| label: rpart-reg
library(baguette)

bag_tree(tree_depth = integer(1), min_n = integer(1), cost_complexity = double(1)) |> 
  set_engine("rpart") |> 
  set_mode("regression") |> 
  translate()

Translation from parsnip to the original package (censored regression)

r uses_extension("bag_tree", "rpart", "censored regression")

#| label: rpart-creg
library(censored)

bag_tree(tree_depth = integer(1), min_n = integer(1), cost_complexity = double(1)) |> 
  set_engine("rpart") |> 
  set_mode("censored regression") |> 
  translate()

Preprocessing requirements

#| child: template-tree-split-factors.Rmd

Case weights

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

Other details

#| child: template-survival-median.Rmd

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.