Skip to content

Commit 435f07d

Browse files
committed
Merge branch 'master' into EmilHvitfeldt-survnip-integration
2 parents 3ade142 + ce24784 commit 435f07d

Some content is hidden

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

72 files changed

+1814
-423
lines changed

.github/workflows/check-pak.yaml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# NOTE: This workflow is overkill for most R packages
2+
# check-standard.yaml is likely a better choice
3+
# usethis::use_github_action("check-standard") will install it.
4+
#
5+
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
6+
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
7+
on:
8+
push:
9+
branches:
10+
- main
11+
- master
12+
pull_request:
13+
branches:
14+
- main
15+
- master
16+
17+
name: R-CMD-check-pak
18+
19+
jobs:
20+
R-CMD-check:
21+
runs-on: ${{ matrix.config.os }}
22+
23+
name: ${{ matrix.config.os }} (${{ matrix.config.r }})
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
config:
29+
- {os: macOS-latest, r: 'release'}
30+
- {os: windows-latest, r: 'release'}
31+
- {os: windows-latest, r: '3.6'}
32+
- {os: ubuntu-16.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest", http-user-agent: "R/4.0.0 (ubuntu-16.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
33+
- {os: ubuntu-16.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
34+
- {os: ubuntu-16.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
35+
- {os: ubuntu-16.04, r: '3.5', rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}
36+
37+
env:
38+
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
39+
RSPM: ${{ matrix.config.rspm }}
40+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
41+
42+
steps:
43+
- uses: actions/checkout@v2
44+
45+
- uses: r-lib/actions/setup-r@v1
46+
id: install-r
47+
with:
48+
r-version: ${{ matrix.config.r }}
49+
http-user-agent: ${{ matrix.config.http-user-agent }}
50+
51+
- uses: r-lib/actions/setup-pandoc@v1
52+
53+
- name: Install pak and query dependencies
54+
run: |
55+
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")
56+
saveRDS(pak::pkg_deps_tree("local::.", dependencies = TRUE), ".github/r-depends.rds")
57+
shell: Rscript {0}
58+
59+
- name: Cache R packages
60+
uses: actions/cache@v2
61+
with:
62+
path: ${{ env.R_LIBS_USER }}
63+
key: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-${{ hashFiles('.github/r-depends.rds') }}
64+
restore-keys: ${{ runner.os }}-${{ steps.install-r.outputs.installed-r-version }}-1-
65+
66+
- name: Install system dependencies
67+
if: runner.os == 'Linux'
68+
run: Rscript -e 'pak::local_system_requirements(execute = TRUE)'
69+
70+
- name: Install dependencies
71+
run: |
72+
pak::local_install_dev_deps(upgrade = TRUE)
73+
pak::pkg_install("rcmdcheck")
74+
shell: Rscript {0}
75+
76+
- name: Install Miniconda
77+
run: |
78+
Rscript -e "pak::pkg_install('rstudio/reticulate')"
79+
Rscript -e "reticulate::install_miniconda()"
80+
81+
- name: Find Miniconda on macOS
82+
if: runner.os == 'macOS'
83+
run: echo "options(reticulate.conda_binary = reticulate:::miniconda_conda())" >> .Rprofile
84+
85+
- name: Install TensorFlow
86+
run: |
87+
reticulate::conda_create('r-reticulate', packages = c('python==3.6.9'))
88+
tensorflow::install_tensorflow(version='1.14.0')
89+
shell: Rscript {0}
90+
91+
- name: Session info
92+
run: |
93+
options(width = 100)
94+
pkgs <- installed.packages()[, "Package"]
95+
sessioninfo::session_info(pkgs, include_base = TRUE)
96+
shell: Rscript {0}
97+
98+
- name: Check
99+
env:
100+
_R_CHECK_CRAN_INCOMING_: false
101+
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
102+
shell: Rscript {0}
103+
104+
- name: Show testthat output
105+
if: always()
106+
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
107+
shell: bash
108+
109+
- name: Upload check results
110+
if: failure()
111+
uses: actions/upload-artifact@main
112+
with:
113+
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
114+
path: check

.github/workflows/pkgdown.yaml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
on:
22
push:
3-
branches: master
3+
branches:
4+
- master
5+
- main
6+
pull_request:
7+
branches:
8+
- master
9+
- main
410

511
name: pkgdown
612

@@ -12,9 +18,12 @@ jobs:
1218
steps:
1319
- uses: actions/checkout@v2
1420

15-
- uses: r-lib/actions/setup-r@master
21+
- uses: r-lib/actions/setup-r@v1
1622

17-
- uses: r-lib/actions/setup-pandoc@master
23+
- uses: r-lib/actions/setup-pandoc@v1
24+
25+
- name: System dependencies
26+
run: brew install harfbuzz fribidi
1827

1928
- name: Query dependencies
2029
run: |
@@ -24,7 +33,7 @@ jobs:
2433
shell: Rscript {0}
2534

2635
- name: Cache R packages
27-
uses: actions/cache@v1
36+
uses: actions/cache@v2
2837
with:
2938
path: ${{ env.R_LIBS_USER }}
3039
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
@@ -36,13 +45,19 @@ jobs:
3645
remotes::install_github("tidyverse/tidytemplate")
3746
remotes::install_cran("tidymodels")
3847
remotes::install_cran("C50")
39-
install.packages("pkgdown")
48+
install.packages("pkgdown", type = "binary")
4049
shell: Rscript {0}
4150

4251
- name: Install package
4352
run: R CMD INSTALL .
4453

54+
- name: Build site
55+
if: github.event_name == 'pull_request'
56+
run: |
57+
Rscript -e 'pkgdown::build_site()'
58+
4559
- name: Deploy package
60+
if: github.event_name == 'push'
4661
run: |
4762
git config --local user.email "[email protected]"
4863
git config --local user.name "GitHub Actions"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ tests/testthat/logs/
88
derby.log
99
logs/*
1010
revdep/*
11+
docs*

DESCRIPTION

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: parsnip
2-
Version: 0.1.4.9000
2+
Version: 0.1.5.9000
33
Title: A Common API to Modeling and Analysis Functions
44
Description: A common interface is provided to allow users to specify a model without having to remember the different argument names across different functions or computational engines (e.g. 'R', 'Spark', 'Stan', etc).
55
Authors@R: c(
@@ -22,8 +22,9 @@ Imports:
2222
purrr,
2323
utils,
2424
tibble (>= 2.1.1),
25-
generics,
25+
generics (>= 0.1.0),
2626
glue,
27+
lifecycle,
2728
magrittr,
2829
stats,
2930
tidyr (>= 1.0.0),
@@ -51,5 +52,5 @@ Suggests:
5152
MASS,
5253
nlme,
5354
modeldata,
54-
liquidSVM,
55+
LiblineaR,
5556
Matrix

NAMESPACE

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
S3method(augment,model_fit)
34
S3method(fit,model_spec)
45
S3method(fit_xy,model_spec)
56
S3method(glance,model_fit)
@@ -56,6 +57,7 @@ S3method(print,nearest_neighbor)
5657
S3method(print,nullmodel)
5758
S3method(print,rand_forest)
5859
S3method(print,surv_reg)
60+
S3method(print,svm_linear)
5961
S3method(print,svm_poly)
6062
S3method(print,svm_rbf)
6163
S3method(req_pkgs,model_fit)
@@ -77,6 +79,7 @@ S3method(translate,multinom_reg)
7779
S3method(translate,nearest_neighbor)
7880
S3method(translate,rand_forest)
7981
S3method(translate,surv_reg)
82+
S3method(translate,svm_linear)
8083
S3method(translate,svm_poly)
8184
S3method(translate,svm_rbf)
8285
S3method(type_sum,model_fit)
@@ -91,6 +94,7 @@ S3method(update,multinom_reg)
9194
S3method(update,nearest_neighbor)
9295
S3method(update,rand_forest)
9396
S3method(update,surv_reg)
97+
S3method(update,svm_linear)
9498
S3method(update,svm_poly)
9599
S3method(update,svm_rbf)
96100
S3method(varying_args,model_spec)
@@ -107,6 +111,7 @@ export(.x)
107111
export(.y)
108112
export(C5.0_train)
109113
export(add_rowindex)
114+
export(augment)
110115
export(boost_tree)
111116
export(check_empty_ellipse)
112117
export(check_final_param)
@@ -149,6 +154,7 @@ export(new_model_spec)
149154
export(null_model)
150155
export(null_value)
151156
export(nullmodel)
157+
export(parsnip_addin)
152158
export(pred_value_template)
153159
export(predict.model_fit)
154160
export(predict_class.model_fit)
@@ -187,7 +193,9 @@ export(show_call)
187193
export(show_engines)
188194
export(show_fit)
189195
export(show_model_info)
196+
export(stan_conf_int)
190197
export(surv_reg)
198+
export(svm_linear)
191199
export(svm_poly)
192200
export(svm_rbf)
193201
export(tidy)
@@ -216,6 +224,7 @@ importFrom(dplyr,starts_with)
216224
importFrom(dplyr,summarise)
217225
importFrom(dplyr,tally)
218226
importFrom(dplyr,vars)
227+
importFrom(generics,augment)
219228
importFrom(generics,fit)
220229
importFrom(generics,fit_xy)
221230
importFrom(generics,glance)
@@ -284,4 +293,5 @@ importFrom(utils,getFromNamespace)
284293
importFrom(utils,globalVariables)
285294
importFrom(utils,head)
286295
importFrom(utils,methods)
296+
importFrom(vctrs,vec_size)
287297
importFrom(vctrs,vec_unique)

NEWS.md

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

3+
* The `liquidSVM` engine for `svm_rbf()` was deprecated due to that package's removal from CRAN. (#425)
4+
5+
* A new linear SVM model `svm_linear()` is now available with the `LiblineaR` engine. (#424)
6+
7+
# parsnip 0.1.5
8+
9+
* An RStudio add-in is available that makes writing multiple `parsnip` model specifications to the source window. It can be accessed via the IDE addin menus or by calling `parsnip_addin()`.
10+
11+
* For `xgboost` models, users can now pass `objective` to `set_engine("xgboost")`. (#403)
12+
13+
* Changes to test for cases when CRAN cannot get `xgboost` to work on their Solaris configuration.
14+
15+
* There is now an `augument()` method for fitted models. See `augment.model_fit`. (#401)
16+
17+
* Column names for `x` are now required when `fit_xy()` is used. (#398)
18+
19+
320
# parsnip 0.1.4
421

522
* `show_engines()` will provide information on the current set for a model.

R/aaa_models.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ check_interface_val <- function(x) {
353353
#' a formula interface, typically some predictor preprocessing must
354354
#' be conducted. `glmnet` is a good example of this.
355355
#'
356-
#' There are three options that can be used for the encodings:
356+
#' There are four options that can be used for the encodings:
357357
#'
358358
#' `predictor_indicators` describes whether and how to create indicator/dummy
359359
#' variables from factor predictors. There are three options: `"none"` (do not
@@ -370,10 +370,15 @@ check_interface_val <- function(x) {
370370
#' intercept, `model.matrix()` computes a full set of indicators for the
371371
#' _first_ factor variable, but an incomplete set for the remainder.
372372
#'
373-
#' Finally, the option `remove_intercept` will remove the intercept column
373+
#' Next, the option `remove_intercept` will remove the intercept column
374374
#' _after_ `model.matrix()` is finished. This can be useful if the model
375375
#' function (e.g. `lm()`) automatically generates an intercept.
376376
#'
377+
#' Finally, `allow_sparse_x` specifies whether the model function can natively
378+
#' accommodate a sparse matrix representation for predictors during fitting
379+
#' and tuning.
380+
#'
381+
#'
377382
#' @references "How to build a parsnip model"
378383
#' \url{https://www.tidymodels.org/learn/develop/models/}
379384
#' @examples

R/add_in.R

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#' Start an RStudio Addin that can write model specifications
2+
#'
3+
#' `parsnip_addin()` starts a process in the RStudio IDE Viewer window
4+
#' that allows users to write code for `parsnip` model specifications from
5+
#' various R packages. The new code is written to the current document at the
6+
#' location of the cursor.
7+
#'
8+
#' @export
9+
parsnip_addin <- function() {
10+
sys.source(
11+
system.file("add-in", "gadget.R", package = "parsnip", mustWork = TRUE),
12+
envir = rlang::new_environment(parent = rlang::global_env()),
13+
keep.source = FALSE
14+
)
15+
}

0 commit comments

Comments
 (0)