Skip to content

Commit 604bece

Browse files
authored
Merge branch 'main' into sparse-input
2 parents 124f925 + d68b765 commit 604bece

Some content is hidden

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

49 files changed

+774
-249
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ on:
1111
branches: [main, master]
1212
workflow_dispatch:
1313

14-
name: R-CMD-check
14+
name: R-CMD-check.yaml
15+
16+
permissions: read-all
1517

1618
jobs:
1719
R-CMD-check:
@@ -26,11 +28,15 @@ jobs:
2628
- {os: macos-latest, r: 'release'}
2729

2830
- {os: windows-latest, r: 'release'}
31+
# use 4.0 or 4.1 to check with rtools40's older compiler
32+
- {os: windows-latest, r: 'oldrel-4'}
2933

30-
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
31-
- {os: ubuntu-latest, r: 'release'}
32-
- {os: ubuntu-latest, r: 'oldrel-1'}
33-
# - {os: ubuntu-latest, r: 'oldrel-2'} # temp until lava pacakge is good
34+
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
35+
- {os: ubuntu-latest, r: 'release'}
36+
- {os: ubuntu-latest, r: 'oldrel-1'}
37+
- {os: ubuntu-latest, r: 'oldrel-2'}
38+
- {os: ubuntu-latest, r: 'oldrel-3'}
39+
#- {os: ubuntu-latest, r: 'oldrel-4'}
3440

3541
env:
3642
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
@@ -40,7 +46,7 @@ jobs:
4046
CXX14FLAGS: -Wall -g -02
4147

4248
steps:
43-
- uses: actions/checkout@v3
49+
- uses: actions/checkout@v4
4450

4551
- uses: r-lib/actions/setup-pandoc@v2
4652

.github/workflows/pkgdown.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ on:
99
types: [published]
1010
workflow_dispatch:
1111

12-
name: pkgdown
12+
name: pkgdown.yaml
13+
14+
permissions: read-all
1315

1416
jobs:
1517
pkgdown:
@@ -19,8 +21,10 @@ jobs:
1921
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
2022
env:
2123
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
24+
permissions:
25+
contents: write
2226
steps:
23-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2428

2529
- uses: r-lib/actions/setup-pandoc@v2
2630

@@ -51,7 +55,7 @@ jobs:
5155

5256
- name: Deploy to GitHub pages 🚀
5357
if: github.event_name != 'pull_request'
54-
uses: JamesIves/github-pages-deploy-action@v4.4.1
58+
uses: JamesIves/github-pages-deploy-action@v4.5.0
5559
with:
5660
clean: false
5761
branch: gh-pages

.github/workflows/pr-commands.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
issue_comment:
55
types: [created]
66

7-
name: Commands
7+
name: pr-commands.yaml
8+
9+
permissions: read-all
810

911
jobs:
1012
document:
@@ -13,8 +15,10 @@ jobs:
1315
runs-on: ubuntu-latest
1416
env:
1517
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
18+
permissions:
19+
contents: write
1620
steps:
17-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
1822

1923
- uses: r-lib/actions/pr-fetch@v2
2024
with:
@@ -50,8 +54,10 @@ jobs:
5054
runs-on: ubuntu-latest
5155
env:
5256
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
57+
permissions:
58+
contents: write
5359
steps:
54-
- uses: actions/checkout@v3
60+
- uses: actions/checkout@v4
5561

5662
- uses: r-lib/actions/pr-fetch@v2
5763
with:

.github/workflows/test-coverage.yaml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ on:
66
pull_request:
77
branches: [main, master]
88

9-
name: test-coverage
9+
name: test-coverage.yaml
10+
11+
permissions: read-all
1012

1113
jobs:
1214
test-coverage:
@@ -15,15 +17,15 @@ jobs:
1517
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1618

1719
steps:
18-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
1921

2022
- uses: r-lib/actions/setup-r@v2
2123
with:
2224
use-public-rspm: true
2325

2426
- uses: r-lib/actions/setup-r-dependencies@v2
2527
with:
26-
extra-packages: any::covr
28+
extra-packages: any::covr, any::xml2
2729
needs: coverage
2830

2931
- name: Install dev reticulate
@@ -44,23 +46,32 @@ jobs:
4446

4547
- name: Test coverage
4648
run: |
47-
covr::codecov(
49+
cov <- covr::package_coverage(
4850
quiet = FALSE,
4951
clean = FALSE,
50-
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
52+
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
5153
)
54+
covr::to_cobertura(cov)
5255
shell: Rscript {0}
5356

57+
- uses: codecov/codecov-action@v4
58+
with:
59+
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
60+
file: ./cobertura.xml
61+
plugin: noop
62+
disable_search: true
63+
token: ${{ secrets.CODECOV_TOKEN }}
64+
5465
- name: Show testthat output
5566
if: always()
5667
run: |
5768
## --------------------------------------------------------------------
58-
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
69+
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
5970
shell: bash
6071

6172
- name: Upload test results
6273
if: failure()
63-
uses: actions/upload-artifact@v3
74+
uses: actions/upload-artifact@v4
6475
with:
6576
name: coverage-test-failures
6677
path: ${{ runner.temp }}/package

DESCRIPTION

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Imports:
2525
ggplot2,
2626
globals,
2727
glue,
28-
hardhat (>= 1.3.1.9000),
28+
hardhat (>= 1.4.0),
2929
lifecycle,
3030
magrittr,
3131
pillar,
@@ -80,6 +80,5 @@ Encoding: UTF-8
8080
LazyData: true
8181
Roxygen: list(markdown = TRUE)
8282
Remotes:
83-
tidymodels/hardhat,
8483
r-lib/sparsevctrs
85-
RoxygenNote: 7.3.1
84+
RoxygenNote: 7.3.2

NEWS.md

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

3-
* Aligned `null_model()` with other model types; the model type now has an
4-
engine argument that defaults to `"parsnip"` and is checked with the same
5-
machinery that checks other model types in the package (#1083).
3+
4+
* `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).
5+
6+
* 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).
67

78
* New `extract_fit_time()` method has been added that returns the time it took to train the model (#853).
89

10+
911
# parsnip 1.2.1
1012

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

R/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
# Some Notes on the Design of `parsnip`
1+
# Some Notes on the Design of parsnip
22

3-
`parsnip` is trying to solve the issues of unified interfaces for the myriad R modeling functions that have very heterogeneous interfaces and return values. It defines a set of modules, which are specific tasks, such as
3+
The parsnip package is trying to solve the issues of unified interfaces for the myriad R modeling functions that have very heterogeneous interfaces and return values. It defines a set of modules, which are specific tasks, such as
44

55
* fitting the model
66
* obtaining numeric predictions for regression models
77
* computing different types of predictions for classification and censored regression models
88

99
and so on. The list of modules is likely to grow over time to include variable importance scores and so on,.
1010

11-
`caret` was written for the same purpose. The approach there was to encapsulate the modules as functions (see [this directory](https://github.com/topepo/caret/tree/master/models/files) for examples). The issue with having these modules as functions are:
11+
The caret package was written for the same purpose. The approach there was to encapsulate the modules as functions (see [this directory](https://github.com/topepo/caret/tree/master/models/files) for examples). The issue with having these modules as functions are:
1212

1313
* A lot of code duplication.
1414
* More difficult to maintain.
1515
* Any functions in open code had to be a dependency of some sort. This led to a long ago version having about 200 package dependencies which was problematic.
1616

17-
To get around the last point, `caret` _compiles_ these modules into a large list and saves it in the package as an RData file. This avoids `R CMD check` from noticing that code and triggering warnings about dependencies.
17+
To get around the last point, caret _compiles_ these modules into a large list and saves it in the package as an RData file. This avoids `R CMD check` from noticing that code and triggering warnings about dependencies.
1818

1919
## Model Fitting Modules
2020

21-
`parsnip` approaches the problem differently and relies more on using `call` objects for the modules. In the simple cases, the fit module is a list that contains information about the module including the package and function name for the call as well as any default options. For example, for logistic regression using `glm`, the module may look like:
21+
parsnip approaches the problem differently and relies more on using `call` objects for the modules. In the simple cases, the fit module is a list that contains information about the module including the package and function name for the call as well as any default options. For example, for logistic regression using `glm`, the module may look like:
2222

2323
```r
2424
list(
@@ -77,9 +77,9 @@ The same is true for quosures.
7777

7878
Making predictions is done in a manner similar to fitting models; a call is created in the same way. However, there are additional complexities.
7979

80-
First, the data or model fit object may require some preprocessing to make the predict function work. This does _not_ include executing a formula method on the data but may include coercing the new data into an appropriate format. It can also be used to check for specific fit object requirements. For example, an additional option is required for the `ranger` package to compute class probabilities. The `pre` element of a prediction module can be used to check that the relevant option is set correctly.
80+
First, the data or model fit object may require some preprocessing to make the predict function work. This does _not_ include executing a formula method on the data but may include coercing the new data into an appropriate format. It can also be used to check for specific fit object requirements. For example, an additional option is required for the ranger package to compute class probabilities. The `pre` element of a prediction module can be used to check that the relevant option is set correctly.
8181

82-
Second, there is a high likelihood that the results of executing the prediction code will require post-processing to put the results into a usable format. `ranger`, for example, returns an object of specific class that contains the predicted values for the new data. The `post` element of the prediction module would extract this value and put it into a more consistent format.
82+
Second, there is a high likelihood that the results of executing the prediction code will require post-processing to put the results into a usable format. ranger, for example, returns an object of specific class that contains the predicted values for the new data. The `post` element of the prediction module would extract this value and put it into a more consistent format.
8383

8484
The postprocessor can also be used to coerce the results into a [_tidy format_](https://tidymodels.github.io/model-implementation-principles/model-predictions.html#return-values).
8585

R/aaa_models.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ check_interface_val <- function(x) {
511511
#' and `raw`.
512512
#' @param pkg An options character string for a package name.
513513
#' @param parsnip A single character string for the "harmonized" argument name
514-
#' that `parsnip` exposes.
514+
#' that parsnip exposes.
515515
#' @param original A single character string for the argument name that
516516
#' underlying model function uses.
517517
#' @param value A list that conforms to the `fit_obj` or `pred_obj` description
@@ -525,7 +525,7 @@ check_interface_val <- function(x) {
525525
#' @keywords internal
526526
#' @details These functions are available for users to add their
527527
#' own models or engines (in a package or otherwise) so that they can
528-
#' be accessed using `parsnip`. This is more thoroughly documented
528+
#' be accessed using parsnip. This is more thoroughly documented
529529
#' on the package web site (see references below).
530530
#'
531531
#' In short, `parsnip` stores an environment object that contains

R/add_in.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' Start an RStudio Addin that can write model specifications
22
#'
33
#' `parsnip_addin()` starts a process in the RStudio IDE Viewer window
4-
#' that allows users to write code for `parsnip` model specifications from
4+
#' that allows users to write code for parsnip model specifications from
55
#' various R packages. The new code is written to the current document at the
66
#' location of the cursor.
77
#'

R/engines.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ load_libs <- function(x, quiet, attach = FALSE) {
7272
#'
7373
#' - _Main arguments_ are more commonly used and tend to be available across
7474
#' engines. These names are standardized to work with different engines in a
75-
#' consistent way, so you can use the \pkg{parsnip} main argument `trees`,
75+
#' consistent way, so you can use the parsnip main argument `trees`,
7676
#' instead of the heterogeneous arguments for this parameter from \pkg{ranger}
7777
#' and \pkg{randomForest} packages (`num.trees` and `ntree`, respectively). Set
7878
#' these in your model type function, like `rand_forest(trees = 2000)`.
@@ -154,10 +154,10 @@ set_engine.default <- function(object, engine, ...) {
154154
#' Display currently available engines for a model
155155
#'
156156
#' The possible engines for a model can depend on what packages are loaded.
157-
#' Some \pkg{parsnip} extension add engines to existing models. For example,
157+
#' Some parsnip extension add engines to existing models. For example,
158158
#' the \pkg{poissonreg} package adds additional engines for the [poisson_reg()]
159159
#' model and these are not available unless \pkg{poissonreg} is loaded.
160-
#' @param x The name of a `parsnip` model (e.g., "linear_reg", "mars", etc.)
160+
#' @param x The name of a parsnip model (e.g., "linear_reg", "mars", etc.)
161161
#' @return A tibble.
162162
#'
163163
#' @examplesIf !parsnip:::is_cran_check()

R/extract.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
#' importance/explainers.
3131
#'
3232
#' However, users should not invoke the `predict()` method on an extracted
33-
#' model. There may be preprocessing operations that `parsnip` has executed on
33+
#' model. There may be preprocessing operations that parsnip has executed on
3434
#' the data prior to giving it to the model. Bypassing these can lead to errors
3535
#' or silently generating incorrect predictions.
3636
#'

0 commit comments

Comments
 (0)