Skip to content

Commit 9277fbe

Browse files
committed
Merge branch 'main' into brulee-two-layer
2 parents 1b272b2 + 8448c06 commit 9277fbe

File tree

312 files changed

+4530
-1979
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

312 files changed

+4530
-1979
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ derby.log
1919
^codecov\.yml$
2020
^LICENSE\.md$
2121
^man-roxygen$
22+
^vignettes/articles$

DESCRIPTION

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Package: parsnip
22
Title: A Common API to Modeling and Analysis Functions
3-
Version: 1.2.1.9003
3+
Version: 1.2.1.9004
44
Authors@R: c(
55
person("Max", "Kuhn", , "max@posit.co", role = c("aut", "cre")),
66
person("Davis", "Vaughan", , "davis@posit.co", role = "aut"),
77
person("Emil", "Hvitfeldt", , "emil.hvitfeldt@posit.co", role = "ctb"),
8-
person("Posit Software, PBC", role = c("cph", "fnd"))
8+
person("Posit Software, PBC", role = c("cph", "fnd"), comment = c(ROR = "03wc8by49"))
99
)
1010
Maintainer: Max Kuhn <max@posit.co>
1111
Description: A common interface is provided to allow users to specify a
@@ -25,23 +25,23 @@ Imports:
2525
ggplot2,
2626
globals,
2727
glue,
28-
hardhat (>= 1.4.0),
28+
hardhat (>= 1.4.1),
2929
lifecycle,
3030
magrittr,
3131
pillar,
3232
prettyunits,
3333
purrr (>= 1.0.0),
3434
rlang (>= 1.1.0),
35-
sparsevctrs (>= 0.1.0.9000),
35+
sparsevctrs (>= 0.2.0),
3636
stats,
3737
tibble (>= 2.1.1),
3838
tidyr (>= 1.3.0),
3939
utils,
4040
vctrs (>= 0.6.0),
4141
withr
4242
Suggests:
43-
C50,
4443
bench,
44+
C50,
4545
covr,
4646
dials (>= 1.1.0),
4747
earth,
@@ -71,14 +71,12 @@ VignetteBuilder:
7171
knitr
7272
ByteCompile: true
7373
Config/Needs/website: C50, dbarts, earth, glmnet, keras, kernlab, kknn,
74-
LiblineaR, mgcv, nnet, parsnip, randomForest, ranger, rpart, rstanarm,
75-
tidymodels/tidymodels, tidyverse/tidytemplate, rstudio/reticulate,
76-
xgboost
74+
LiblineaR, mgcv, nnet, parsnip, quantreg, randomForest, ranger, rpart,
75+
rstanarm, tidymodels/tidymodels, tidyverse/tidytemplate, rstudio/reticulate,
76+
xgboost, rmarkdown
7777
Config/rcmdcheck/ignore-inconsequential-notes: true
7878
Config/testthat/edition: 3
7979
Encoding: UTF-8
8080
LazyData: true
8181
Roxygen: list(markdown = TRUE)
82-
Remotes:
83-
r-lib/sparsevctrs
8482
RoxygenNote: 7.3.2

NAMESPACE

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ export(.dat)
185185
export(.extract_surv_status)
186186
export(.extract_surv_time)
187187
export(.facts)
188+
export(.get_prediction_column_names)
188189
export(.lvls)
189190
export(.model_param_name_key)
190191
export(.obs)
@@ -202,7 +203,6 @@ export(bag_mars)
202203
export(bag_mlp)
203204
export(bag_tree)
204205
export(bart)
205-
export(bartMachine_interval_calc)
206206
export(boost_tree)
207207
export(case_weights_allowed)
208208
export(cforest_train)
@@ -221,6 +221,7 @@ export(discrim_flexible)
221221
export(discrim_linear)
222222
export(discrim_quad)
223223
export(discrim_regularized)
224+
export(ensure_parsnip_format)
224225
export(eval_args)
225226
export(extract_fit_engine)
226227
export(extract_fit_time)
@@ -253,6 +254,7 @@ export(glm_grouped)
253254
export(has_multi_predict)
254255
export(importance_weights)
255256
export(is_varying)
257+
export(keras_activations)
256258
export(keras_mlp)
257259
export(keras_predict_classes)
258260
export(knit_engine_docs)
@@ -264,6 +266,7 @@ export(make_classes)
264266
export(make_engine_list)
265267
export(make_seealso_list)
266268
export(mars)
269+
export(matrix_to_quantile_pred)
267270
export(max_mtry_formula)
268271
export(maybe_data_frame)
269272
export(maybe_matrix)
@@ -311,7 +314,6 @@ export(rand_forest)
311314
export(repair_call)
312315
export(req_pkgs)
313316
export(required_pkgs)
314-
export(rpart_train)
315317
export(rule_fit)
316318
export(set_args)
317319
export(set_dependency)
@@ -377,6 +379,7 @@ importFrom(generics,tune_args)
377379
importFrom(generics,varying_args)
378380
importFrom(ggplot2,autoplot)
379381
importFrom(glue,glue_collapse)
382+
importFrom(hardhat,contr_one_hot)
380383
importFrom(hardhat,extract_fit_engine)
381384
importFrom(hardhat,extract_fit_time)
382385
importFrom(hardhat,extract_parameter_dials)

NEWS.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,53 @@
11
# parsnip (development version)
22

3+
## New Features
4+
5+
* A new model mode (`"quantile regression"`) was added. Including:
6+
* A `linear_reg()` engine for `"quantreg"`.
7+
* Predictions are encoded via a custom vector type. See [hardhat::quantile_pred()].
8+
* Predicted quantile levels are designated when the new mode is specified. See `?set_mode`.
9+
310
* `fit_xy()` can now take dgCMatrix input for `x` argument (#1121).
411

5-
* `fit()` and `fit_xy()` can now take sparse tibbles as data values (#1165).
12+
* `fit_xy()` can now take sparse tibbles as data values (#1165).
613

714
* `predict()` can now take dgCMatrix and sparse tibble input for `new_data` argument, and error informatively when model doesn't support it (#1167).
815

9-
* Transitioned package errors and warnings to use cli (#1147 and #1148 by
10-
@shum461, #1153 by @RobLBaker and @wright13, #1154 by @JamesHWade, #1160,
11-
#1161, #1081).
16+
* New `extract_fit_time()` method has been added that returns the time it took to train the model (#853).
17+
18+
* `mlp()` with `keras` engine now work for all activation functions currently supported by `keras` (#1127).
19+
20+
## Other Changes
21+
22+
* Transitioned package errors and warnings to use cli (#1147 and #1148 by @shum461, #1153 by @RobLBaker and @wright13, #1154 by @JamesHWade, #1160, #1161, #1081).
1223

1324
* `fit_xy()` currently raises an error for `gen_additive_mod()` model specifications as the default engine (`"mgcv"`) specifies smoothing terms in model formulas. However, some engines specify smooths via additional arguments, in which case the restriction on `fit_xy()` is excessive. parsnip will now only raise an error when fitting a `gen_additive_mod()` with `fit_xy()` when using the `"mgcv"` engine (#775).
1425

1526
* Aligned `null_model()` with other model types; the model type now has an engine argument that defaults to `"parsnip"` and is checked with the same machinery that checks other model types in the package (#1083).
1627

17-
* New `extract_fit_time()` method has been added that returns the time it took to train the model (#853).
28+
* If linear regression is requested with a Poisson family, an error will occur and refer the user to `poisson_reg()` (#1219).
29+
30+
* The deprecated function `rpart_train()` was removed after its deprecation period (#1044).
31+
32+
## Bug Fixes
33+
34+
* Make sure that parsnip does not convert ordered factor predictions to be unordered.
1835

1936
* Ensure that `knit_engine_docs()` has the required packages installed (#1156).
2037

2138
* Fixed bug where some models fit using `fit_xy()` couldn't predict (#1166).
2239

40+
* Fixed bug related to using local (non-package) models (#1229)
41+
42+
* `tunable()` now references a dials object for the `mixture` parameter (#1236)
43+
44+
## Breaking Change
45+
46+
* For quantile prediction, the `quantile` argument to `predict()` has been deprecate in facor of `quantile_levels`. This does not affect models with mode `"quantile regression"`.
47+
48+
* The quantile regression prediction type was disabled for the deprecated `surv_reg()` model.
49+
50+
2351
# parsnip 1.2.1
2452

2553
* Added a missing `tidy()` method for survival analysis glmnet models (#1086).

R/README.md

Lines changed: 0 additions & 85 deletions
This file was deleted.
File renamed without changes.

R/import-standalone-types-check.R renamed to R/aaa-import-standalone-types-check.R

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Standalone file: do not edit by hand
2-
# Source: <https://github.com/r-lib/rlang/blob/main/R/standalone-types-check.R>
3-
# ----------------------------------------------------------------------
4-
#
51
# ---
62
# repo: r-lib/rlang
73
# file: standalone-types-check.R
@@ -13,6 +9,9 @@
139
#
1410
# ## Changelog
1511
#
12+
# 2024-08-15:
13+
# - `check_character()` gains an `allow_na` argument (@martaalcalde, #1724)
14+
#
1615
# 2023-03-13:
1716
# - Improved error messages of number checkers (@teunbrand)
1817
# - Added `allow_infinite` argument to `check_number_whole()` (@mgirlich).
@@ -461,15 +460,28 @@ check_formula <- function(x,
461460

462461
# Vectors -----------------------------------------------------------------
463462

463+
# TODO: Figure out what to do with logical `NA` and `allow_na = TRUE`
464+
464465
check_character <- function(x,
465466
...,
467+
allow_na = TRUE,
466468
allow_null = FALSE,
467469
arg = caller_arg(x),
468470
call = caller_env()) {
471+
469472
if (!missing(x)) {
470473
if (is_character(x)) {
474+
if (!allow_na && any(is.na(x))) {
475+
abort(
476+
sprintf("`%s` can't contain NA values.", arg),
477+
arg = arg,
478+
call = call
479+
)
480+
}
481+
471482
return(invisible(NULL))
472483
}
484+
473485
if (allow_null && is_null(x)) {
474486
return(invisible(NULL))
475487
}
@@ -479,7 +491,6 @@ check_character <- function(x,
479491
x,
480492
"a character vector",
481493
...,
482-
allow_na = FALSE,
483494
allow_null = allow_null,
484495
arg = arg,
485496
call = call

0 commit comments

Comments
 (0)