diff --git a/.Rbuildignore b/.Rbuildignore index 40e1973c8..fbe868029 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -17,3 +17,4 @@ derby.log ^\.github$ ^CODE_OF_CONDUCT\.md$ ^README\.html$ +^codecov\.yml$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 000000000..2d19fc766 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index cf63479cc..c918c583e 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -1,4 +1,7 @@ -on: [push, pull_request] +on: + push: + pull_request: + types: [opened, synchronize, reopened] name: R-CMD-check @@ -17,44 +20,78 @@ jobs: - { os: windows-latest, r: 'devel'} - { os: ubuntu-16.04, r: '3.5', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"} - { os: ubuntu-16.04, r: '3.6', cran: "https://demo.rstudiopm.com/all/__linux__/xenial/latest"} + env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true - PIP_NO_WARN_SCRIPT_LOCATION: false + RSPM: ${{ matrix.config.rspm }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@master + with: + r-version: ${{ matrix.config.r }} - uses: r-lib/actions/setup-pandoc@master + - name: Query dependencies + run: | + install.packages('remotes') + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") + shell: Rscript {0} + - name: Cache R packages if: runner.os != 'Windows' uses: actions/cache@v1 with: path: ${{ env.R_LIBS_USER }} - key: ${{ runner.os }}-r-${{ matrix.config.r }}-${{ hashFiles('DESCRIPTION') }} + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- - name: Install system dependencies if: runner.os == 'Linux' env: RHUB_PLATFORM: linux-x86_64-ubuntu-gcc run: | - Rscript -e "install.packages('remotes')" -e "remotes::install_github('r-hub/sysreqs')" + Rscript -e "remotes::install_github('r-hub/sysreqs')" sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))") sudo -s eval "$sysreqs" + - name: Install dependencies - run: Rscript -e "install.packages('remotes')" -e "remotes::install_deps(dependencies = TRUE)" -e "remotes::install_cran('rcmdcheck')" + run: | + remotes::install_deps(dependencies = TRUE) + remotes::install_cran("rcmdcheck") + shell: Rscript {0} - name: Install TensorFlow run: | - Rscript -e "remotes::install_github('rstudio/reticulate') # TODO remove when reticulate 1.14 is on CRAN" Rscript -e "reticulate::install_miniconda()" Rscript -e "reticulate::conda_create('r-reticulate', packages = 'python==3.6.9')" Rscript -e "tensorflow::install_tensorflow(version='1.14.0')" + - name: Check run: Rscript -e "rcmdcheck::rcmdcheck(args = '--no-manual', error_on = 'warning', check_dir = 'check')" + - name: Session info + run: | + options(width = 100) + pkgs <- installed.packages()[, "Package"] + sessioninfo::session_info(pkgs, include_base = TRUE) + shell: Rscript {0} + + - name: Check + env: + _R_CHECK_CRAN_INCOMING_: false + run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") + shell: Rscript {0} + + - name: Show testthat output + if: always() + run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + - name: Upload check results if: failure() uses: actions/upload-artifact@master diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml new file mode 100644 index 000000000..0d3cb7162 --- /dev/null +++ b/.github/workflows/pr-commands.yaml @@ -0,0 +1,51 @@ +on: + issue_comment: + types: [created] +name: Commands +jobs: + document: + if: startsWith(github.event.comment.body, '/document') + name: document + runs-on: macOS-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + - uses: r-lib/actions/pr-fetch@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - uses: r-lib/actions/setup-r@master + - name: Install dependencies + run: Rscript -e 'install.packages(c("remotes", "roxygen2"))' -e 'remotes::install_deps(dependencies = TRUE)' + - name: Document + run: Rscript -e 'roxygen2::roxygenise()' + - name: commit + run: | + git add man/\* NAMESPACE + git commit -m 'Document' + - uses: r-lib/actions/pr-push@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + style: + if: startsWith(github.event.comment.body, '/style') + name: style + runs-on: macOS-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + - uses: r-lib/actions/pr-fetch@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - uses: r-lib/actions/setup-r@master + - name: Install dependencies + run: Rscript -e 'install.packages("styler")' + - name: Style + run: Rscript -e 'styler::style_pkg()' + - name: commit + run: | + git add \*.R + git commit -m 'Style' + - uses: r-lib/actions/pr-push@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml new file mode 100644 index 000000000..2338abea3 --- /dev/null +++ b/.github/workflows/test-coverage.yaml @@ -0,0 +1,52 @@ +on: + push: + branches: + - master + pull_request: + branches: + - master + +name: test-coverage + +jobs: + test-coverage: + runs-on: macOS-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@master + + - uses: r-lib/actions/setup-pandoc@master + + - name: Query dependencies + run: | + install.packages('remotes') + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") + shell: Rscript {0} + + - name: Cache R packages + uses: actions/cache@v1 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + + - name: Install dependencies + run: | + install.packages(c("remotes")) + remotes::install_deps(dependencies = TRUE) + remotes::install_cran("covr") + shell: Rscript {0} + + - name: Install TensorFlow + run: | + Rscript -e "reticulate::install_miniconda()" + Rscript -e "reticulate::conda_create('r-reticulate', packages = 'python==3.6.9')" + Rscript -e "tensorflow::install_tensorflow(version='1.14.0')" + + - name: Test coverage + run: covr::codecov() + shell: Rscript {0} diff --git a/README.Rmd b/README.Rmd index 81178f700..d9f035751 100644 --- a/README.Rmd +++ b/README.Rmd @@ -22,6 +22,8 @@ knitr::opts_chunk$set( [](https://cran.rstudio.com/package=parsnip) [](https://www.tidyverse.org/lifecycle/#maturing) +[](https://codecov.io/gh/tidymodels/parsnip?branch=master) +[](https://github.com/tidymodels/parsnip/actions) ## Introduction diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000..04c558599 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,14 @@ +comment: false + +coverage: + status: + project: + default: + target: auto + threshold: 1% + informational: true + patch: + default: + target: auto + threshold: 1% + informational: true diff --git a/docs/404.html b/docs/404.html index 709c736a2..c64cfd877 100644 --- a/docs/404.html +++ b/docs/404.html @@ -9,18 +9,18 @@
A list of all parsnip models across different CRAN packages can be found at tidymodels.org.
Data sets previously found in parsnip are now find in the modeldata package.
tidyr >= 1.0.0 is now required.tidyr >= 1.0.0 is now required.
SVM models produced by kernlab now use the formula method. This change was due to how ksvm() made indicator variables for factor predictors (with one-hot encodings). Since the ordinary formula method did not do this, the data are passed as-is to ksvm() so that the results are closer to what one would get if ksmv() were called directly.
MARS models produced by earth now use the formula method.
Under-the-hood changes were made so that non-standard data arguments in the modeling packages can be accomodated. (#315)
boost_tree() called stop_iter for early stopping. The xgb_train() function gained arguments for early stopping and a percentage of data to leave out for a validation set.A new main argument was added to boost_tree() called stop_iter for early stopping. The xgb_train() function gained arguments for early stopping and a percentage of data to leave out for a validation set.
If fit() is used and the underlying model uses a formula, the actual formula is pass to the model (instead of a placeholder). This makes the model call better.
A function named repair_call() was added. This can help change the underlying models call object to better reflect what they would have obtained if the model function had been used directly (instead of via parsnip). This is only useful when the user chooses a formula interface and the model uses a formula interface. It will also be of limited use when a recipes is used to construct the feature set in workflows or tune.
boost_tree() %>% - set_engine("xgboost") %>% - set_mode("regression") %>% - translate()
## Boosted Tree Model Specification (regression) -## -## Computational engine: xgboost -## -## Model fit template: -## parsnip::xgb_train(x = missing_arg(), y = missing_arg(), nthread = 1, -## verbose = 0) -
boost_tree() %>% - set_engine("xgboost") %>% - set_mode("classification") %>% - translate()
## Boosted Tree Model Specification (classification) -## -## Computational engine: xgboost -## -## Model fit template: -## parsnip::xgb_train(x = missing_arg(), y = missing_arg(), nthread = 1, -## verbose = 0) -+
boost_tree() %>% + set_engine("xgboost") %>% + set_mode("regression") %>% + translate()
## Boosted Tree Model Specification (regression) +## +## Computational engine: xgboost +## +## Model fit template: +## parsnip::xgb_train(x = missing_arg(), y = missing_arg(), nthread = 1, +## verbose = 0)
boost_tree() %>% + set_engine("xgboost") %>% + set_mode("classification") %>% + translate()
## Boosted Tree Model Specification (classification) +## +## Computational engine: xgboost +## +## Model fit template: +## parsnip::xgb_train(x = missing_arg(), y = missing_arg(), nthread = 1, +## verbose = 0)
boost_tree() %>% - set_engine("C5.0") %>% - set_mode("classification") %>% - translate()
## Boosted Tree Model Specification (classification) -## -## Computational engine: C5.0 -## -## Model fit template: -## parsnip::C5.0_train(x = missing_arg(), y = missing_arg(), weights = missing_arg()) -+
boost_tree() %>% + set_engine("C5.0") %>% + set_mode("classification") %>% + translate()
## Boosted Tree Model Specification (classification) +## +## Computational engine: C5.0 +## +## Model fit template: +## parsnip::C5.0_train(x = missing_arg(), y = missing_arg(), weights = missing_arg())
Note that C50::C5.0() does not require factor
predictors to be converted to indicator variables.
boost_tree() %>% - set_engine("spark") %>% - set_mode("regression") %>% - translate()
## Boosted Tree Model Specification (regression) -## -## Computational engine: spark -## -## Model fit template: -## sparklyr::ml_gradient_boosted_trees(x = missing_arg(), formula = missing_arg(), -## type = "regression", seed = sample.int(10^5, 1)) -
boost_tree() %>% - set_engine("spark") %>% - set_mode("classification") %>% - translate()
## Boosted Tree Model Specification (classification) -## -## Computational engine: spark -## -## Model fit template: -## sparklyr::ml_gradient_boosted_trees(x = missing_arg(), formula = missing_arg(), -## type = "classification", seed = sample.int(10^5, 1)) -+
boost_tree() %>% + set_engine("spark") %>% + set_mode("regression") %>% + translate()
## Boosted Tree Model Specification (regression) +## +## Computational engine: spark +## +## Model fit template: +## sparklyr::ml_gradient_boosted_trees(x = missing_arg(), formula = missing_arg(), +## type = "regression", seed = sample.int(10^5, 1))
boost_tree() %>% + set_engine("spark") %>% + set_mode("classification") %>% + translate()
## Boosted Tree Model Specification (classification) +## +## Computational engine: spark +## +## Model fit template: +## sparklyr::ml_gradient_boosted_trees(x = missing_arg(), formula = missing_arg(), +## type = "classification", seed = sample.int(10^5, 1))
decision_tree() %>% - set_engine("rpart") %>% - set_mode("regression") %>% - translate()
## Decision Tree Model Specification (regression) -## -## Computational engine: rpart -## -## Model fit template: -## rpart::rpart(formula = missing_arg(), data = missing_arg(), weights = missing_arg()) -
decision_tree() %>% - set_engine("rpart") %>% - set_mode("classification") %>% - translate()
## Decision Tree Model Specification (classification) -## -## Computational engine: rpart -## -## Model fit template: -## rpart::rpart(formula = missing_arg(), data = missing_arg(), weights = missing_arg()) -+
decision_tree() %>% + set_engine("rpart") %>% + set_mode("regression") %>% + translate()
## Decision Tree Model Specification (regression) +## +## Computational engine: rpart +## +## Model fit template: +## rpart::rpart(formula = missing_arg(), data = missing_arg(), weights = missing_arg())
decision_tree() %>% + set_engine("rpart") %>% + set_mode("classification") %>% + translate()
## Decision Tree Model Specification (classification) +## +## Computational engine: rpart +## +## Model fit template: +## rpart::rpart(formula = missing_arg(), data = missing_arg(), weights = missing_arg())
Note that rpart::rpart() does not require factor
predictors to be converted to indicator variables.
decision_tree() %>% - set_engine("C5.0") %>% - set_mode("classification") %>% - translate()
## Decision Tree Model Specification (classification) -## -## Computational engine: C5.0 -## -## Model fit template: -## parsnip::C5.0_train(x = missing_arg(), y = missing_arg(), weights = missing_arg(), -## trials = 1) -+
decision_tree() %>% + set_engine("C5.0") %>% + set_mode("classification") %>% + translate()
## Decision Tree Model Specification (classification) +## +## Computational engine: C5.0 +## +## Model fit template: +## parsnip::C5.0_train(x = missing_arg(), y = missing_arg(), weights = missing_arg(), +## trials = 1)
Note that C50::C5.0() does not require factor
predictors to be converted to indicator variables.
decision_tree() %>% - set_engine("spark") %>% - set_mode("regression") %>% - translate()
## Decision Tree Model Specification (regression) -## -## Computational engine: spark -## -## Model fit template: -## sparklyr::ml_decision_tree_classifier(x = missing_arg(), formula = missing_arg(), -## seed = sample.int(10^5, 1)) -
decision_tree() %>% - set_engine("spark") %>% - set_mode("classification") %>% - translate()
## Decision Tree Model Specification (classification) -## -## Computational engine: spark -## -## Model fit template: -## sparklyr::ml_decision_tree_classifier(x = missing_arg(), formula = missing_arg(), -## seed = sample.int(10^5, 1)) -+
decision_tree() %>% + set_engine("spark") %>% + set_mode("regression") %>% + translate()
## Decision Tree Model Specification (regression) +## +## Computational engine: spark +## +## Model fit template: +## sparklyr::ml_decision_tree_classifier(x = missing_arg(), formula = missing_arg(), +## seed = sample.int(10^5, 1))
decision_tree() %>% + set_engine("spark") %>% + set_mode("classification") %>% + translate()
## Decision Tree Model Specification (classification) +## +## Computational engine: spark +## +## Model fit template: +## sparklyr::ml_decision_tree_classifier(x = missing_arg(), formula = missing_arg(), +## seed = sample.int(10^5, 1))
If the formula Species ~ . where used:
@@ -206,9 +206,9 @@Details .obs() = 150 .lvls() = c(setosa = 50, versicolor = 50, virginica = 50) .facts() = 0 - .y() = <vector> (Species as a vector) - .x() = <data.frame> (The other 4 columns as a data frame) - .dat() = <data.frame> (The full data set) + .y() = <vector> (Species as a vector) + .x() = <data.frame> (The other 4 columns as a data frame) + .dat() = <data.frame> (The full data set)
To use these in a model fit, pass them to a model specification. diff --git a/docs/dev/reference/fit.html b/docs/dev/reference/fit.html index 37b87cc8f..52522745e 100644 --- a/docs/dev/reference/fit.html +++ b/docs/dev/reference/fit.html @@ -263,7 +263,8 @@
## Linear Regression Model Specification (regression) -## -## Computational engine: lm -## -## Model fit template: -## stats::lm(formula = missing_arg(), data = missing_arg(), weights = missing_arg()) -+
linear_reg() %>% + set_engine("lm") %>% + set_mode("regression") %>% + translate()
## Linear Regression Model Specification (regression) +## +## Computational engine: lm +## +## Model fit template: +## stats::lm(formula = missing_arg(), data = missing_arg(), weights = missing_arg())
linear_reg() %>% - set_engine("glmnet") %>% - set_mode("regression") %>% - translate()
## Linear Regression Model Specification (regression) -## -## Computational engine: glmnet -## -## Model fit template: -## glmnet::glmnet(x = missing_arg(), y = missing_arg(), weights = missing_arg(), -## family = "gaussian") -+
linear_reg() %>% + set_engine("glmnet") %>% + set_mode("regression") %>% + translate()
## Linear Regression Model Specification (regression) +## +## Computational engine: glmnet +## +## Model fit template: +## glmnet::glmnet(x = missing_arg(), y = missing_arg(), weights = missing_arg(), +## family = "gaussian")
For glmnet models, the full regularization path is always fit
regardless of the value given to penalty. Also, there is the option to
@@ -293,17 +291,16 @@
linear_reg() %>% - set_engine("stan") %>% - set_mode("regression") %>% - translate()
## Linear Regression Model Specification (regression) -## -## Computational engine: stan -## -## Model fit template: -## rstanarm::stan_glm(formula = missing_arg(), data = missing_arg(), -## weights = missing_arg(), family = stats::gaussian, refresh = 0) -+
linear_reg() %>% + set_engine("stan") %>% + set_mode("regression") %>% + translate()
## Linear Regression Model Specification (regression) +## +## Computational engine: stan +## +## Model fit template: +## rstanarm::stan_glm(formula = missing_arg(), data = missing_arg(), +## weights = missing_arg(), family = stats::gaussian, refresh = 0)
Note that the refresh default prevents logging of the estimation
process. Change this value in set_engine() will show the logs.
linear_reg() %>% - set_engine("spark") %>% - set_mode("regression") %>% - translate()
## Linear Regression Model Specification (regression) -## -## Computational engine: spark -## -## Model fit template: -## sparklyr::ml_linear_regression(x = missing_arg(), formula = missing_arg(), -## weight_col = missing_arg()) -+
linear_reg() %>% + set_engine("spark") %>% + set_mode("regression") %>% + translate()
## Linear Regression Model Specification (regression) +## +## Computational engine: spark +## +## Model fit template: +## sparklyr::ml_linear_regression(x = missing_arg(), formula = missing_arg(), +## weight_col = missing_arg())
linear_reg() %>% - set_engine("keras") %>% - set_mode("regression") %>% - translate()
## Linear Regression Model Specification (regression) -## -## Computational engine: keras -## -## Model fit template: -## parsnip::keras_mlp(x = missing_arg(), y = missing_arg(), hidden_units = 1, -## act = "linear") -+
linear_reg() %>% + set_engine("keras") %>% + set_mode("regression") %>% + translate()
## Linear Regression Model Specification (regression) +## +## Computational engine: keras +## +## Model fit template: +## parsnip::keras_mlp(x = missing_arg(), y = missing_arg(), hidden_units = 1, +## act = "linear")
logistic_reg() %>% - set_engine("glm") %>% - set_mode("classification") %>% - translate()
## Logistic Regression Model Specification (classification) -## -## Computational engine: glm -## -## Model fit template: -## stats::glm(formula = missing_arg(), data = missing_arg(), weights = missing_arg(), -## family = stats::binomial) -+
logistic_reg() %>% + set_engine("glm") %>% + set_mode("classification") %>% + translate()
## Logistic Regression Model Specification (classification) +## +## Computational engine: glm +## +## Model fit template: +## stats::glm(formula = missing_arg(), data = missing_arg(), weights = missing_arg(), +## family = stats::binomial)
logistic_reg() %>% - set_engine("glmnet") %>% - set_mode("classification") %>% - translate()
## Logistic Regression Model Specification (classification) -## -## Computational engine: glmnet -## -## Model fit template: -## glmnet::glmnet(x = missing_arg(), y = missing_arg(), weights = missing_arg(), -## family = "binomial") -+
logistic_reg() %>% + set_engine("glmnet") %>% + set_mode("classification") %>% + translate()
## Logistic Regression Model Specification (classification) +## +## Computational engine: glmnet +## +## Model fit template: +## glmnet::glmnet(x = missing_arg(), y = missing_arg(), weights = missing_arg(), +## family = "binomial")
For glmnet models, the full regularization path is always fit
regardless of the value given to penalty. Also, there is the option to
@@ -292,17 +290,16 @@
logistic_reg() %>% - set_engine("stan") %>% - set_mode("classification") %>% - translate()
## Logistic Regression Model Specification (classification) -## -## Computational engine: stan -## -## Model fit template: -## rstanarm::stan_glm(formula = missing_arg(), data = missing_arg(), -## weights = missing_arg(), family = stats::binomial, refresh = 0) -+
logistic_reg() %>% + set_engine("stan") %>% + set_mode("classification") %>% + translate()
## Logistic Regression Model Specification (classification) +## +## Computational engine: stan +## +## Model fit template: +## rstanarm::stan_glm(formula = missing_arg(), data = missing_arg(), +## weights = missing_arg(), family = stats::binomial, refresh = 0)
Note that the refresh default prevents logging of the estimation
process. Change this value in set_engine() will show the logs.
logistic_reg() %>% - set_engine("spark") %>% - set_mode("classification") %>% - translate()
## Logistic Regression Model Specification (classification) -## -## Computational engine: spark -## -## Model fit template: -## sparklyr::ml_logistic_regression(x = missing_arg(), formula = missing_arg(), -## weight_col = missing_arg(), family = "binomial") -+
logistic_reg() %>% + set_engine("spark") %>% + set_mode("classification") %>% + translate()
## Logistic Regression Model Specification (classification) +## +## Computational engine: spark +## +## Model fit template: +## sparklyr::ml_logistic_regression(x = missing_arg(), formula = missing_arg(), +## weight_col = missing_arg(), family = "binomial")
logistic_reg() %>% - set_engine("keras") %>% - set_mode("classification") %>% - translate()
## Logistic Regression Model Specification (classification) -## -## Computational engine: keras -## -## Model fit template: -## parsnip::keras_mlp(x = missing_arg(), y = missing_arg(), hidden_units = 1, -## act = "linear") -+
logistic_reg() %>% + set_engine("keras") %>% + set_mode("classification") %>% + translate()
## Logistic Regression Model Specification (classification) +## +## Computational engine: keras +## +## Model fit template: +## parsnip::keras_mlp(x = missing_arg(), y = missing_arg(), hidden_units = 1, +## act = "linear")
mars() %>% - set_engine("earth") %>% - set_mode("regression") %>% - translate()
## MARS Model Specification (regression) -## -## Computational engine: earth -## -## Model fit template: -## earth::earth(x = missing_arg(), y = missing_arg(), weights = missing_arg(), -## keepxy = TRUE) -
mars() %>% - set_engine("earth") %>% - set_mode("classification") %>% - translate()
## MARS Model Specification (classification) -## -## Engine-Specific Arguments: -## glm = list(family = stats::binomial) -## -## Computational engine: earth -## -## Model fit template: -## earth::earth(x = missing_arg(), y = missing_arg(), weights = missing_arg(), -## glm = list(family = stats::binomial), keepxy = TRUE) -+
mars() %>% + set_engine("earth") %>% + set_mode("regression") %>% + translate()
## MARS Model Specification (regression) +## +## Computational engine: earth +## +## Model fit template: +## earth::earth(formula = missing_arg(), data = missing_arg(), weights = missing_arg(), +## keepxy = TRUE)
mars() %>% + set_engine("earth") %>% + set_mode("classification") %>% + translate()
## MARS Model Specification (classification) +## +## Engine-Specific Arguments: +## glm = list(family = stats::binomial) +## +## Computational engine: earth +## +## Model fit template: +## earth::earth(formula = missing_arg(), data = missing_arg(), weights = missing_arg(), +## glm = list(family = stats::binomial), keepxy = TRUE)
Note that, when the model is fit, the earth package only has its
namespace loaded. However, if multi_predict is used, the package is
diff --git a/docs/dev/reference/mlp.html b/docs/dev/reference/mlp.html
index 8d4bdcee1..a84fd2ae5 100644
--- a/docs/dev/reference/mlp.html
+++ b/docs/dev/reference/mlp.html
@@ -276,57 +276,53 @@
mlp() %>% - set_engine("keras") %>% - set_mode("regression") %>% - translate()
## Single Layer Neural Network Specification (regression) -## -## Computational engine: keras -## -## Model fit template: -## parsnip::keras_mlp(x = missing_arg(), y = missing_arg()) -
mlp() %>% - set_engine("keras") %>% - set_mode("classification") %>% - translate()
## Single Layer Neural Network Specification (classification) -## -## Computational engine: keras -## -## Model fit template: -## parsnip::keras_mlp(x = missing_arg(), y = missing_arg()) -+
mlp() %>% + set_engine("keras") %>% + set_mode("regression") %>% + translate()
## Single Layer Neural Network Specification (regression) +## +## Computational engine: keras +## +## Model fit template: +## parsnip::keras_mlp(x = missing_arg(), y = missing_arg())
mlp() %>% + set_engine("keras") %>% + set_mode("classification") %>% + translate()
## Single Layer Neural Network Specification (classification) +## +## Computational engine: keras +## +## Model fit template: +## parsnip::keras_mlp(x = missing_arg(), y = missing_arg())
An error is thrown if both penalty and dropout are specified for
keras models.
mlp() %>% - set_engine("nnet") %>% - set_mode("regression") %>% - translate()
## Single Layer Neural Network Specification (regression) -## -## Main Arguments: -## hidden_units = 5 -## -## Computational engine: nnet -## -## Model fit template: -## nnet::nnet(formula = missing_arg(), data = missing_arg(), weights = missing_arg(), -## size = 5, trace = FALSE, linout = TRUE) -
mlp() %>% - set_engine("nnet") %>% - set_mode("classification") %>% - translate()
## Single Layer Neural Network Specification (classification) -## -## Main Arguments: -## hidden_units = 5 -## -## Computational engine: nnet -## -## Model fit template: -## nnet::nnet(formula = missing_arg(), data = missing_arg(), weights = missing_arg(), -## size = 5, trace = FALSE, linout = FALSE) -+
mlp() %>% + set_engine("nnet") %>% + set_mode("regression") %>% + translate()
## Single Layer Neural Network Specification (regression) +## +## Main Arguments: +## hidden_units = 5 +## +## Computational engine: nnet +## +## Model fit template: +## nnet::nnet(formula = missing_arg(), data = missing_arg(), weights = missing_arg(), +## size = 5, trace = FALSE, linout = TRUE)
mlp() %>% + set_engine("nnet") %>% + set_mode("classification") %>% + translate()
## Single Layer Neural Network Specification (classification) +## +## Main Arguments: +## hidden_units = 5 +## +## Computational engine: nnet +## +## Model fit template: +## nnet::nnet(formula = missing_arg(), data = missing_arg(), weights = missing_arg(), +## size = 5, trace = FALSE, linout = FALSE)
multinom_reg() %>% - set_engine("glmnet") %>% - set_mode("classification") %>% - translate()
## Multinomial Regression Model Specification (classification) -## -## Computational engine: glmnet -## -## Model fit template: -## glmnet::glmnet(x = missing_arg(), y = missing_arg(), weights = missing_arg(), -## family = "multinomial") -+
multinom_reg() %>% + set_engine("glmnet") %>% + set_mode("classification") %>% + translate()
## Multinomial Regression Model Specification (classification) +## +## Computational engine: glmnet +## +## Model fit template: +## glmnet::glmnet(x = missing_arg(), y = missing_arg(), weights = missing_arg(), +## family = "multinomial")
For glmnet models, the full regularization path is always fit
regardless of the value given to penalty. Also, there is the option to
@@ -277,45 +276,42 @@
multinom_reg() %>% - set_engine("nnet") %>% - set_mode("classification") %>% - translate()
## Multinomial Regression Model Specification (classification) -## -## Computational engine: nnet -## -## Model fit template: -## nnet::multinom(formula = missing_arg(), data = missing_arg(), -## weights = missing_arg(), trace = FALSE) -+
multinom_reg() %>% + set_engine("nnet") %>% + set_mode("classification") %>% + translate()
## Multinomial Regression Model Specification (classification) +## +## Computational engine: nnet +## +## Model fit template: +## nnet::multinom(formula = missing_arg(), data = missing_arg(), +## weights = missing_arg(), trace = FALSE)
multinom_reg() %>% - set_engine("spark") %>% - set_mode("classification") %>% - translate()
## Multinomial Regression Model Specification (classification) -## -## Computational engine: spark -## -## Model fit template: -## sparklyr::ml_logistic_regression(x = missing_arg(), formula = missing_arg(), -## weight_col = missing_arg(), family = "multinomial") -+
multinom_reg() %>% + set_engine("spark") %>% + set_mode("classification") %>% + translate()
## Multinomial Regression Model Specification (classification) +## +## Computational engine: spark +## +## Model fit template: +## sparklyr::ml_logistic_regression(x = missing_arg(), formula = missing_arg(), +## weight_col = missing_arg(), family = "multinomial")
multinom_reg() %>% - set_engine("keras") %>% - set_mode("classification") %>% - translate()
## Multinomial Regression Model Specification (classification) -## -## Computational engine: keras -## -## Model fit template: -## parsnip::keras_mlp(x = missing_arg(), y = missing_arg(), hidden_units = 1, -## act = "linear") -+
multinom_reg() %>% + set_engine("keras") %>% + set_mode("classification") %>% + translate()
## Multinomial Regression Model Specification (classification) +## +## Computational engine: keras +## +## Model fit template: +## parsnip::keras_mlp(x = missing_arg(), y = missing_arg(), hidden_units = 1, +## act = "linear")
nearest_neighbor() %>% - set_engine("kknn") %>% - set_mode("regression") %>% - translate()
## K-Nearest Neighbor Model Specification (regression) -## -## Computational engine: kknn -## -## Model fit template: -## kknn::train.kknn(formula = missing_arg(), data = missing_arg(), -## ks = 5) -
nearest_neighbor() %>% - set_engine("kknn") %>% - set_mode("classification") %>% - translate()
## K-Nearest Neighbor Model Specification (classification) -## -## Computational engine: kknn -## -## Model fit template: -## kknn::train.kknn(formula = missing_arg(), data = missing_arg(), -## ks = 5) -+
nearest_neighbor() %>% + set_engine("kknn") %>% + set_mode("regression") %>% + translate()
## K-Nearest Neighbor Model Specification (regression) +## +## Computational engine: kknn +## +## Model fit template: +## kknn::train.kknn(formula = missing_arg(), data = missing_arg(), +## ks = 5)
nearest_neighbor() %>% + set_engine("kknn") %>% + set_mode("classification") %>% + translate()
## K-Nearest Neighbor Model Specification (classification) +## +## Computational engine: kknn +## +## Model fit template: +## kknn::train.kknn(formula = missing_arg(), data = missing_arg(), +## ks = 5)
For kknn, the underlying modeling function used is a restricted
version of train.kknn() and not kknn(). It is set up in this way so
diff --git a/docs/dev/reference/null_model.html b/docs/dev/reference/null_model.html
index c299fd299..f5890685b 100644
--- a/docs/dev/reference/null_model.html
+++ b/docs/dev/reference/null_model.html
@@ -171,25 +171,23 @@
null_model() %>% - set_engine("parsnip") %>% - set_mode("regression") %>% - translate()
## Model Specification (regression) -## -## Computational engine: parsnip -## -## Model fit template: -## nullmodel(x = missing_arg(), y = missing_arg()) -
null_model() %>% - set_engine("parsnip") %>% - set_mode("classification") %>% - translate()
## Model Specification (classification) -## -## Computational engine: parsnip -## -## Model fit template: -## nullmodel(x = missing_arg(), y = missing_arg()) -+
null_model() %>% + set_engine("parsnip") %>% + set_mode("regression") %>% + translate()
## Model Specification (regression) +## +## Computational engine: parsnip +## +## Model fit template: +## nullmodel(x = missing_arg(), y = missing_arg())
null_model() %>% + set_engine("parsnip") %>% + set_mode("classification") %>% + translate()
## Model Specification (classification) +## +## Computational engine: parsnip +## +## Model fit template: +## nullmodel(x = missing_arg(), y = missing_arg())
rand_forest() %>% - set_engine("ranger") %>% - set_mode("regression") %>% - translate()
## Random Forest Model Specification (regression) -## -## Computational engine: ranger -## -## Model fit template: -## ranger::ranger(formula = missing_arg(), data = missing_arg(), -## case.weights = missing_arg(), num.threads = 1, verbose = FALSE, -## seed = sample.int(10^5, 1)) -
rand_forest() %>% - set_engine("ranger") %>% - set_mode("classification") %>% - translate()
## Random Forest Model Specification (classification) -## -## Computational engine: ranger -## -## Model fit template: -## ranger::ranger(formula = missing_arg(), data = missing_arg(), -## case.weights = missing_arg(), num.threads = 1, verbose = FALSE, -## seed = sample.int(10^5, 1), probability = TRUE) -+
rand_forest() %>% + set_engine("ranger") %>% + set_mode("regression") %>% + translate()
## Random Forest Model Specification (regression) +## +## Computational engine: ranger +## +## Model fit template: +## ranger::ranger(formula = missing_arg(), data = missing_arg(), +## case.weights = missing_arg(), num.threads = 1, verbose = FALSE, +## seed = sample.int(10^5, 1))
rand_forest() %>% + set_engine("ranger") %>% + set_mode("classification") %>% + translate()
## Random Forest Model Specification (classification) +## +## Computational engine: ranger +## +## Model fit template: +## ranger::ranger(formula = missing_arg(), data = missing_arg(), +## case.weights = missing_arg(), num.threads = 1, verbose = FALSE, +## seed = sample.int(10^5, 1), probability = TRUE)
Note that ranger::ranger() does not require
factor predictors to be converted to indicator variables.
rand_forest() %>% - set_engine("randomForest") %>% - set_mode("regression") %>% - translate()
## Random Forest Model Specification (regression) -## -## Computational engine: randomForest -## -## Model fit template: -## randomForest::randomForest(x = missing_arg(), y = missing_arg()) -
rand_forest() %>% - set_engine("randomForest") %>% - set_mode("classification") %>% - translate()
## Random Forest Model Specification (classification) -## -## Computational engine: randomForest -## -## Model fit template: -## randomForest::randomForest(x = missing_arg(), y = missing_arg()) -+
rand_forest() %>% + set_engine("randomForest") %>% + set_mode("regression") %>% + translate()
## Random Forest Model Specification (regression) +## +## Computational engine: randomForest +## +## Model fit template: +## randomForest::randomForest(x = missing_arg(), y = missing_arg())
rand_forest() %>% + set_engine("randomForest") %>% + set_mode("classification") %>% + translate()
## Random Forest Model Specification (classification) +## +## Computational engine: randomForest +## +## Model fit template: +## randomForest::randomForest(x = missing_arg(), y = missing_arg())
Note that
randomForest::randomForest() does
not require factor predictors to be converted to indicator variables.
rand_forest() %>% - set_engine("spark") %>% - set_mode("regression") %>% - translate()
## Random Forest Model Specification (regression) -## -## Computational engine: spark -## -## Model fit template: -## sparklyr::ml_random_forest(x = missing_arg(), formula = missing_arg(), -## type = "regression", seed = sample.int(10^5, 1)) -
rand_forest() %>% - set_engine("spark") %>% - set_mode("classification") %>% - translate()
## Random Forest Model Specification (classification) -## -## Computational engine: spark -## -## Model fit template: -## sparklyr::ml_random_forest(x = missing_arg(), formula = missing_arg(), -## type = "classification", seed = sample.int(10^5, 1)) -+
rand_forest() %>% + set_engine("spark") %>% + set_mode("regression") %>% + translate()
## Random Forest Model Specification (regression) +## +## Computational engine: spark +## +## Model fit template: +## sparklyr::ml_random_forest(x = missing_arg(), formula = missing_arg(), +## type = "regression", seed = sample.int(10^5, 1))
rand_forest() %>% + set_engine("spark") %>% + set_mode("classification") %>% + translate()
## Random Forest Model Specification (classification) +## +## Computational engine: spark +## +## Model fit template: +## sparklyr::ml_random_forest(x = missing_arg(), formula = missing_arg(), +## type = "classification", seed = sample.int(10^5, 1))
These objects are imported from other packages. Follow the links below to see their documentation.
-%>%
When the user passes a formula to fit() and the underyling model function
+uses a formula, the call object produced by fit() may not be usable by
+other functions. For example, some arguments may still be quosures and the
+data portion of the call will not correspond to the original data.
repair_call(x, data)+ +
| x | +A fitted |
+
|---|---|
| data | +A data object that is relavant to the call. In most cases, this
+is the data frame that was given to |
+
A modified parsnip fitted model.
repair_call() call can adjust the model objects call to be usable by other
+functions and methods.
++fitted_model <- + linear_reg() %>% + set_engine("lm", model = TRUE) %>% + fit(mpg ~ ., data = mtcars) + +# In this call, note that `data` is not `mtcars` and the `model = ~TRUE` +# indicates that the `model` argument is an `rlang` quosure. +fitted_model$fit$call#> stats::lm(formula = mpg ~ ., data = data, model = ~TRUE)+# All better: +repair_call(fitted_model, mtcars)$fit$call#> stats::lm(formula = mpg ~ ., data = mtcars, model = TRUE)
surv_reg() %>% - set_engine("flexsurv") %>% - set_mode("regression") %>% - translate()
## Parametric Survival Regression Model Specification (regression) -## -## Computational engine: flexsurv -## -## Model fit template: -## flexsurv::flexsurvreg(formula = missing_arg(), data = missing_arg(), -## weights = missing_arg()) -+
surv_reg() %>% + set_engine("flexsurv") %>% + set_mode("regression") %>% + translate()
## Parametric Survival Regression Model Specification (regression) +## +## Computational engine: flexsurv +## +## Model fit template: +## flexsurv::flexsurvreg(formula = missing_arg(), data = missing_arg(), +## weights = missing_arg())
surv_reg() %>% - set_engine("survival") %>% - set_mode("regression") %>% - translate()
## Parametric Survival Regression Model Specification (regression) -## -## Computational engine: survival -## -## Model fit template: -## survival::survreg(formula = missing_arg(), data = missing_arg(), -## weights = missing_arg(), model = TRUE) -+
surv_reg() %>% + set_engine("survival") %>% + set_mode("regression") %>% + translate()
## Parametric Survival Regression Model Specification (regression) +## +## Computational engine: survival +## +## Model fit template: +## survival::survreg(formula = missing_arg(), data = missing_arg(), +## weights = missing_arg(), model = TRUE)
Note that model = TRUE is needed to produce quantile predictions when
there is a stratification variable and can be overridden in other cases.
svm_poly() %>% - set_engine("kernlab") %>% - set_mode("regression") %>% - translate()
## Polynomial Support Vector Machine Specification (regression) -## -## Computational engine: kernlab -## -## Model fit template: -## kernlab::ksvm(x = missing_arg(), y = missing_arg(), kernel = "polydot") -
svm_poly() %>% - set_engine("kernlab") %>% - set_mode("classification") %>% - translate()
## Polynomial Support Vector Machine Specification (classification) -## -## Computational engine: kernlab -## -## Model fit template: -## kernlab::ksvm(x = missing_arg(), y = missing_arg(), kernel = "polydot", -## prob.model = TRUE) -+
svm_poly() %>% + set_engine("kernlab") %>% + set_mode("regression") %>% + translate()
## Polynomial Support Vector Machine Specification (regression) +## +## Computational engine: kernlab +## +## Model fit template: +## kernlab::ksvm(x = missing_arg(), data = missing_arg(), kernel = "polydot")
svm_poly() %>% + set_engine("kernlab") %>% + set_mode("classification") %>% + translate()
## Polynomial Support Vector Machine Specification (classification) +## +## Computational engine: kernlab +## +## Model fit template: +## kernlab::ksvm(x = missing_arg(), data = missing_arg(), kernel = "polydot", +## prob.model = TRUE)
svm_rbf() %>% - set_engine("kernlab") %>% - set_mode("regression") %>% - translate()
## Radial Basis Function Support Vector Machine Specification (regression) -## -## Computational engine: kernlab -## -## Model fit template: -## kernlab::ksvm(x = missing_arg(), y = missing_arg(), kernel = "rbfdot") -
svm_rbf() %>% - set_engine("kernlab") %>% - set_mode("classification") %>% - translate()
## Radial Basis Function Support Vector Machine Specification (classification) -## -## Computational engine: kernlab -## -## Model fit template: -## kernlab::ksvm(x = missing_arg(), y = missing_arg(), kernel = "rbfdot", -## prob.model = TRUE) -+
svm_rbf() %>% + set_engine("kernlab") %>% + set_mode("regression") %>% + translate()
## Radial Basis Function Support Vector Machine Specification (regression) +## +## Computational engine: kernlab +## +## Model fit template: +## kernlab::ksvm(x = missing_arg(), data = missing_arg(), kernel = "rbfdot")
svm_rbf() %>% + set_engine("kernlab") %>% + set_mode("classification") %>% + translate()
## Radial Basis Function Support Vector Machine Specification (classification) +## +## Computational engine: kernlab +## +## Model fit template: +## kernlab::ksvm(x = missing_arg(), data = missing_arg(), kernel = "rbfdot", +## prob.model = TRUE)
svm_rbf() %>% - set_engine("liquidSVM") %>% - set_mode("regression") %>% - translate()
## Radial Basis Function Support Vector Machine Specification (regression) -## -## Computational engine: liquidSVM -## -## Model fit template: -## liquidSVM::svm(x = missing_arg(), y = missing_arg(), folds = 1, -## threads = 0) -
svm_rbf() %>% - set_engine("liquidSVM") %>% - set_mode("classification") %>% - translate()
## Radial Basis Function Support Vector Machine Specification (classification) -## -## Computational engine: liquidSVM -## -## Model fit template: -## liquidSVM::svm(x = missing_arg(), y = missing_arg(), folds = 1, -## threads = 0) -+
svm_rbf() %>% + set_engine("liquidSVM") %>% + set_mode("regression") %>% + translate()
## Radial Basis Function Support Vector Machine Specification (regression) +## +## Computational engine: liquidSVM +## +## Model fit template: +## liquidSVM::svm(x = missing_arg(), y = missing_arg(), folds = 1, +## threads = 0)
svm_rbf() %>% + set_engine("liquidSVM") %>% + set_mode("classification") %>% + translate()
## Radial Basis Function Support Vector Machine Specification (classification) +## +## Computational engine: liquidSVM +## +## Model fit template: +## liquidSVM::svm(x = missing_arg(), y = missing_arg(), folds = 1, +## threads = 0)
Note that models created using the liquidSVM engine cannot be saved
like conventional R objects. The fit slot of the model_fit object
diff --git a/docs/dev/reference/tidy.nullmodel.html b/docs/dev/reference/tidy.nullmodel.html
index ddc40e72a..80b406d17 100644
--- a/docs/dev/reference/tidy.nullmodel.html
+++ b/docs/dev/reference/tidy.nullmodel.html
@@ -164,14 +164,14 @@
A tibble with column value.
#> # A tibble: 1 x 1 ++#> <dbl> +#> 1 20.1#> # A tibble: 1 x 1 #> value -#> <chr> -#> 1 setosa#> # A tibble: 1 x 1 +#> <chr> +#> 1 setosa#> # A tibble: 1 x 1 #> value -#> <dbl> -#> 1 20.1