Skip to content

RC 1.3.2 #1274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: parsnip
Title: A Common API to Modeling and Analysis Functions
Version: 1.3.1.9000
Version: 1.3.2
Authors@R: c(
person("Max", "Kuhn", , "max@posit.co", role = c("aut", "cre")),
person("Davis", "Vaughan", , "davis@posit.co", role = "aut"),
Expand Down
8 changes: 7 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# parsnip (development version)
# parsnip 1.3.2

* Switch to base R pipe

* Requires changes for CRAN's "No Suggests" check.

* Avoid issues with reading from package files. (#1271)

# parsnip 1.3.1

Expand Down
291 changes: 146 additions & 145 deletions R/aaa_archive.R

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion R/boost_tree.R
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ xgb_by_tree <- function(tree, object, new_data, type, ...) {
#' @param weights An optional numeric vector of case weights. Note
#' that the data used for the case weights will not be used as a
#' splitting variable in the model (see
#' \url{https://www.rulequest.com/see5-info.html} for
#' `https://www.rulequest.com/see5-info.html` for
#' Quinlan's notes on case weights).
#' @param minCases An integer for the smallest number of samples
#' that must be put in at least two of the splits.
Expand Down
2 changes: 1 addition & 1 deletion R/engine_docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
}

exts <-
utils::read.delim(system.file("models.tsv", package = "parsnip")) |>
model_info_table |>

Check warning on line 211 in R/engine_docs.R

View check run for this annotation

Codecov / codecov/patch

R/engine_docs.R#L211

Added line #L211 was not covered by tests
dplyr::filter(model == mod) |>
dplyr::group_by(engine, mode) |>
dplyr::summarize(extensions = sum(!is.na(pkg)), .groups = "drop") |>
Expand Down
2 changes: 1 addition & 1 deletion man/C5.0_train.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions man/details_bart_dbarts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/rmd/aaa.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ check_pkg_for_docs(parsnip:::extensions())
make_mode_list <- function(mod, eng) {
modes <- c("regression", "classification", "censored regression")
exts <-
utils::read.delim(system.file("models.tsv", package = "parsnip")) |>
model_info_table |>
dplyr::filter(model == mod & engine == eng) |>
dplyr::mutate(mode = factor(mode, levels = modes)) |>
dplyr::arrange(mode)
Expand Down Expand Up @@ -128,7 +128,7 @@ descr_models <- function(mod, eng) {

uses_extension <- function(mod, eng, mod_mode) {
exts <-
utils::read.delim(system.file("models.tsv", package = "parsnip")) |>
model_info_table |>
dplyr::filter(
model == mod &
engine == eng &
Expand Down
10 changes: 6 additions & 4 deletions man/rmd/bart_dbarts.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -56,31 +56,33 @@ Some relevant arguments that can be passed to `set_engine()`:

```{r}
#| label: bart-cls
bart(
parsnip::bart(
trees = integer(1),
prior_terminal_node_coef = double(1),
prior_terminal_node_expo = double(1),
prior_outcome_range = double(1)
) |>
set_engine("dbarts") |>
set_mode("classification") |>
translate()
translate() |>
print_model_spec()
```


## Translation from parsnip to the original package (regression)

```{r}
#| label: bart-reg
bart(
parsnip::bart(
trees = integer(1),
prior_terminal_node_coef = double(1),
prior_terminal_node_expo = double(1),
prior_outcome_range = double(1)
) |>
set_engine("dbarts") |>
set_mode("regression") |>
translate()
translate()|>
print_model_spec()
```

## Preprocessing requirements
Expand Down
40 changes: 32 additions & 8 deletions man/rmd/bart_dbarts.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,43 +41,67 @@ Some relevant arguments that can be passed to `set_engine()`:


``` r
bart(
parsnip::bart(
trees = integer(1),
prior_terminal_node_coef = double(1),
prior_terminal_node_expo = double(1),
prior_outcome_range = double(1)
) |>
set_engine("dbarts") |>
set_mode("classification") |>
translate()
translate() |>
print_model_spec()
```

```
## BART Model Specification (classification)
##
## Call:
## NULL
## Main Arguments:
## trees = integer(1)
## prior_terminal_node_coef = double(1)
## prior_terminal_node_expo = double(1)
## prior_outcome_range = double(1)
##
## Computational engine: dbarts
##
## Model fit template:
## dbarts::bart(x = missing_arg(), y = missing_arg(), ntree = integer(1),
## base = double(1), power = double(1), k = double(1), verbose = FALSE,
## keeptrees = TRUE, keepcall = FALSE)
```


## Translation from parsnip to the original package (regression)


``` r
bart(
parsnip::bart(
trees = integer(1),
prior_terminal_node_coef = double(1),
prior_terminal_node_expo = double(1),
prior_outcome_range = double(1)
) |>
set_engine("dbarts") |>
set_mode("regression") |>
translate()
translate()|>
print_model_spec()
```

```
## BART Model Specification (regression)
##
## Main Arguments:
## trees = integer(1)
## prior_terminal_node_coef = double(1)
## prior_terminal_node_expo = double(1)
## prior_outcome_range = double(1)
##
## Computational engine: dbarts
##
## Call:
## NULL
## Model fit template:
## dbarts::bart(x = missing_arg(), y = missing_arg(), ntree = integer(1),
## base = double(1), power = double(1), k = double(1), verbose = FALSE,
## keeptrees = TRUE, keepcall = FALSE)
```

## Preprocessing requirements
Expand Down
14 changes: 14 additions & 0 deletions tests/testthat/helper-objects.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,17 @@ if (rlang::is_installed("modeldata")) {
}
}

if (rlang::is_installed("survival")) {
data(cancer, package = "survival")
basic_form <- survival::Surv(time, status) ~ age
complete_form <- survival::Surv(time) ~ age

if (R.Version()$major < "4") {
data(lung, package = 'survival')
} else {
data(cancer, package = 'survival')
}

basic_form <- survival::Surv(time, status) ~ group
complete_form <- survival::Surv(time) ~ group
}
6 changes: 3 additions & 3 deletions tests/testthat/test-surv_reg_flexsurv.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
data(cancer, package = "survival")

basic_form <- survival::Surv(time, status) ~ age
complete_form <- survival::Surv(time) ~ age

# ------------------------------------------------------------------------------

test_that('flexsurv execution', {
skip_if_not_installed("flexsurv")
skip_if_not_installed("survival")

rlang::local_options(lifecycle_verbosity = "quiet")
surv_basic <- surv_reg() |> set_engine("flexsurv")
Expand Down Expand Up @@ -43,6 +41,8 @@ test_that('flexsurv execution', {

test_that('flexsurv prediction', {
skip_if_not_installed("flexsurv")
skip_if_not_installed("survival")


rlang::local_options(lifecycle_verbosity = "quiet")
surv_basic <- surv_reg() |> set_engine("flexsurv")
Expand Down
7 changes: 0 additions & 7 deletions tests/testthat/test-surv_reg_survreg.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
if (R.Version()$major < "4") {
data(lung, package = 'survival')
} else {
data(cancer, package = 'survival')
}

basic_form <- survival::Surv(time, status) ~ group
complete_form <- survival::Surv(time) ~ group

# ------------------------------------------------------------------------------

Expand Down