diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml
index c918c583e..f05519f1d 100644
--- a/.github/workflows/R-CMD-check.yaml
+++ b/.github/workflows/R-CMD-check.yaml
@@ -71,9 +71,6 @@ jobs:
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)
diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml
new file mode 100644
index 000000000..d8d02c19b
--- /dev/null
+++ b/.github/workflows/pkgdown.yaml
@@ -0,0 +1,46 @@
+on:
+ push:
+ branches: master
+
+name: pkgdown
+
+jobs:
+ pkgdown:
+ 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("remotes")
+ remotes::install_deps(dependencies = TRUE)
+ remotes::install_dev("pkgdown")
+ remotes::install_github("tidyverse/tidytemplate")
+ shell: Rscript {0}
+
+ - name: Install package
+ run: R CMD INSTALL .
+
+ - name: Deploy package
+ run: pkgdown::deploy_to_branch(new_process = FALSE)
+ shell: Rscript {0}
diff --git a/R/linear_reg.R b/R/linear_reg.R
index 5b9ea3333..b2e9e7892 100644
--- a/R/linear_reg.R
+++ b/R/linear_reg.R
@@ -7,8 +7,8 @@
#' \itemize{
#' \item \code{penalty}: The total amount of regularization
#' in the model. Note that this must be zero for some engines.
-#' \item \code{mixture}: The proportion of L1 regularization in
-#' the model. Note that this will be ignored for some engines.
+#' \item \code{mixture}: The mixture amounts of different types of
+#' regularization (see below). Note that this will be ignored for some engines.
#' }
#' These arguments are converted to their specific names at the
#' time that the model is fit. Other options and argument can be
@@ -23,11 +23,11 @@
#' amount of regularization (`glmnet`, `keras`, and `spark` only).
#' For `keras` models, this corresponds to purely L2 regularization
#' (aka weight decay) while the other models can be a combination
-#' of L1 and L2 (depending on the value of `mixture`).
-#' @param mixture A number between zero and one (inclusive) that
-#' represents the proportion of regularization that is used for the
-#' L2 penalty (i.e. weight decay, or ridge regression) versus L1
-#' (the lasso) (`glmnet` and `spark` only).
+#' of L1 and L2 (depending on the value of `mixture`; see below).
+#' @param mixture A number between zero and one (inclusive) that is the
+#' proportion of L1 regularization (i.e. lasso) in the model. When
+#' `mixture = 1`, it is a pure lasso model while `mixture = 0` indicates that
+#' ridge regression is being used. (`glmnet` and `spark` only).
#' @details
#' The data given to the function are not saved and are only used
#' to determine the _mode_ of the model. For `linear_reg()`, the
diff --git a/R/logistic_reg.R b/R/logistic_reg.R
index 8ea210372..46f379658 100644
--- a/R/logistic_reg.R
+++ b/R/logistic_reg.R
@@ -7,8 +7,8 @@
#' \itemize{
#' \item \code{penalty}: The total amount of regularization
#' in the model. Note that this must be zero for some engines.
-#' \item \code{mixture}: The proportion of L1 regularization in
-#' the model. Note that this will be ignored for some engines.
+#' \item \code{mixture}: The mixture amounts of different types of
+#' regularization (see below). Note that this will be ignored for some engines.
#' }
#' These arguments are converted to their specific names at the
#' time that the model is fit. Other options and argument can be
@@ -24,10 +24,10 @@
#' For `keras` models, this corresponds to purely L2 regularization
#' (aka weight decay) while the other models can be a combination
#' of L1 and L2 (depending on the value of `mixture`).
-#' @param mixture A number between zero and one (inclusive) that
-#' represents the proportion of regularization that is used for the
-#' L2 penalty (i.e. weight decay, or ridge regression) versus L1
-#' (the lasso) (`glmnet` and `spark` only).
+#' @param mixture A number between zero and one (inclusive) that is the
+#' proportion of L1 regularization (i.e. lasso) in the model. When
+#' `mixture = 1`, it is a pure lasso model while `mixture = 0` indicates that
+#' ridge regression is being used. (`glmnet` and `spark` only).
#' @details
#' For `logistic_reg()`, the mode will always be "classification".
#'
diff --git a/R/multinom_reg.R b/R/multinom_reg.R
index 99068c410..d6245c980 100644
--- a/R/multinom_reg.R
+++ b/R/multinom_reg.R
@@ -7,8 +7,8 @@
#' \itemize{
#' \item \code{penalty}: The total amount of regularization
#' in the model. Note that this must be zero for some engines.
-#' \item \code{mixture}: The proportion of L1 regularization in
-#' the model. Note that this will be ignored for some engines.
+#' \item \code{mixture}: The mixture amounts of different types of
+#' regularization (see below). Note that this will be ignored for some engines.
#' }
#' These arguments are converted to their specific names at the
#' time that the model is fit. Other options and argument can be
@@ -24,10 +24,10 @@
#' For `keras` models, this corresponds to purely L2 regularization
#' (aka weight decay) while the other models can be a combination
#' of L1 and L2 (depending on the value of `mixture`).
-#' @param mixture A number between zero and one (inclusive) that
-#' represents the proportion of regularization that is used for the
-#' L2 penalty (i.e. weight decay, or ridge regression) versus L1
-#' (the lasso) (`glmnet` only).
+#' @param mixture A number between zero and one (inclusive) that is the
+#' proportion of L1 regularization (i.e. lasso) in the model. When
+#' `mixture = 1`, it is a pure lasso model while `mixture = 0` indicates that
+#' ridge regression is being used. (`glmnet` and `spark` only).
#' @details
#' For `multinom_reg()`, the mode will always be "classification".
#'
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 5553f7551..8e1596dc1 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -3,8 +3,9 @@ url: https://parsnip.tidymodels.org
template:
package: tidytemplate
params:
+ theme: tidymodels
part_of: tidymodels
- footer: parsnip is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.
+ footer: parsnip is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.
# https://github.com/tidyverse/tidytemplate for css
diff --git a/docs/404.html b/docs/404.html
deleted file mode 100644
index c64cfd877..000000000
--- a/docs/404.html
+++ /dev/null
@@ -1,174 +0,0 @@
-
-
-
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
-
-
-
-Our Standards
-
Examples of behavior that contributes to a positive environment for our community include:
-
-
Demonstrating empathy and kindness toward other people
-
Being respectful of differing opinions, viewpoints, and experiences
-
Giving and gracefully accepting constructive feedback
-
Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
-
Focusing on what is best not just for us as individuals, but for the overall community
-
-
Examples of unacceptable behavior include:
-
-
The use of sexualized language or imagery, and sexual attention or advances of any kind
-
Trolling, insulting or derogatory comments, and personal or political attacks
-
Public or private harassment
-
Publishing others’ private information, such as a physical or email address, without their explicit permission
-
Other conduct which could reasonably be considered inappropriate in a professional setting
-
-
-
-
-Enforcement Responsibilities
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
-
-
-
-Scope
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
-
-
-
-Enforcement
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
-
-
-
-Enforcement Guidelines
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
-
-
-1. Correction
-
Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
-
Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
-
-
-
-2. Warning
-
Community Impact: A violation through a single incident or series of actions.
-
Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
-
-
-
-3. Temporary Ban
-
Community Impact: A serious violation of community standards, including sustained inappropriate behavior.
-
Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
-
-
-
-4. Permanent Ban
-
Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
-
Consequence: A permanent ban from any sort of public interaction within the community.
For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https:// www.contributor-covenant.org/translations.
Some R packages can create predictions from models that are different than the one that was fit. For example, if a boosted tree is fit with 10 iterations of boosting, the model can usually make predictions on submodels that have less than 10 trees (all other parameters being static). This is helpful for model tuning since you can cheap evaluate tuning parameter combinations and can often results in a large speed-up in the computations.
-
In parsnip, there is a method called multi_predict() that can do this. It’s current methods are:
For multi_predict(), the same semantics of predict() are used but, for this model, there is an extra argument called trees. Candidate submodel values can be passed in with trees:
The results is a tibble that has as many rows as the data being predicted (n = 111). The .pred column contains a list of tibbles and each has the predictions across the different number of trees:
To get this into a format that is more usable, we can use tidyr::unnest() but we first add row numbers so that we can track the predictions by test sample as well as the actual classes:
This package provides functions and methods to create and manipulate functions commonly used during modeling (e.g. fitting the model, making predictions, etc). It allows the user to manipulate how the same type of model can be created from different sources. It also contains a basic framework for model parameter tuning.
-
-
-Motivation
-
Modeling functions across different R packages can have very different interfaces. If you would like to try different approaches, there is a lot of syntactical minutiae to remember. The problem worsens when you move in-between platforms (e.g. doing a logistic regression in R’s glm versus Spark’s implementation).
-
parsnip tries to solve this by providing similar interfaces to models. For example, if you are fitting a random forest model and would like to adjust the number of trees in the forest there are different argument names to remember:
The package makes the translation between trees and the real names in each of the implementations.
-
Some terminology:
-
-
The model type differentiates models. Example types are: random forests, logistic regression, linear support vector machines, etc.
-
The mode of the model denotes how it will be used. Two common modes are classification and regression. Others would include “censored regression” and “risk regression” (parametric and Cox PH models for censored data, respectively), as well as unsupervised models (e.g. “clustering”).
-
The computational engine indicates how the actual model might be fit. These are often R packages (such as randomForest or ranger) but might also be methods outside of R (e.g. Stan, Spark, and others).
-
-
parsnip, similar to ggplot2, dplyr and recipes, separates the specification of what you want to do from the actual doing. This allows us to create broader functionality for modeling.
-
-
-
-Placeholders for Parameters
-
There are times where you would like to change a parameter from its default but you are not sure what the final value will be. This is the basis for model tuning. Since the model is not executing when created, these types of parameters can be changed using the varying() function. This provides a simple placeholder for the value.
-
tune_mtry <-rand_forest(trees =2000, mtry =varying())
-tune_mtry
-#> Random Forest Model Specification (unknown)
-#>
-#> Main Arguments:
-#> mtry = varying()
-#> trees = 2000
-
This will come in handy later when we fit the model over different values of mtry.
-
-
-
-Specifying Arguments
-
Commonly used arguments to the modeling functions have their parameters exposed in the function. For example, rand_forest has arguments for:
-
-
-mtry: The number of predictors that will be randomly sampled at each split when creating the tree models.
-
-trees: The number of trees contained in the ensemble.
-
-min_n: The minimum number of data points in a node that are required for the node to be split further.
-
-
The arguments to the default function are:
-
args(rand_forest)
-#> function (mode = "unknown", mtry = NULL, trees = NULL, min_n = NULL)
-#> NULL
-
However, there might be other arguments that you would like to change or allow to vary. These are accessible using set_engine. For example, ranger has an option to set the internal random number seed. To set this to a specific value:
#> parsnip model object
-#>
-#>
-#> Call:
-#> randomForest(x = as.data.frame(x), y = y, ntree = ~2000, mtry = ~4)
-#> Type of random forest: regression
-#> Number of trees: 2000
-#> No. of variables tried at each split: 4
-#>
-#> Mean of squared residuals: 5.52
-#> % Var explained: 84.3
-
Note that the call objects show num.trees = ~2000. The tilde is the consequence of parsnip using quosures to process the model specification’s arguments.
-
Normally, when a function is executed, the function’s arguments are immediately evaluated. In the case of parsnip, the model specification’s arguments are not; the expression is captured along with the environment where it should be evaluated. That is what a quosure does.
-
parsnip uses these expressions to make a model fit call that is evaluated. The tilde in the call above reflects that the argument was captured using a quosure.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/articles/parsnip_Intro_files/header-attrs-2.1/header-attrs.js b/docs/articles/parsnip_Intro_files/header-attrs-2.1/header-attrs.js
deleted file mode 100644
index dd57d92e0..000000000
--- a/docs/articles/parsnip_Intro_files/header-attrs-2.1/header-attrs.js
+++ /dev/null
@@ -1,12 +0,0 @@
-// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
-// be compatible with the behavior of Pandoc < 2.8).
-document.addEventListener('DOMContentLoaded', function(e) {
- var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
- var i, h, a;
- for (i = 0; i < hs.length; i++) {
- h = hs[i];
- if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
- a = h.attributes;
- while (a.length > 0) h.removeAttribute(a[0].name);
- }
-});
diff --git a/docs/authors.html b/docs/authors.html
deleted file mode 100644
index 5ead777c5..000000000
--- a/docs/authors.html
+++ /dev/null
@@ -1,181 +0,0 @@
-
-
-
-
-
-
-
-
-Authors • parsnip
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
-
-
-
-Our Standards
-
Examples of behavior that contributes to a positive environment for our community include:
-
-
Demonstrating empathy and kindness toward other people
-
Being respectful of differing opinions, viewpoints, and experiences
-
Giving and gracefully accepting constructive feedback
-
Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
-
Focusing on what is best not just for us as individuals, but for the overall community
-
-
Examples of unacceptable behavior include:
-
-
The use of sexualized language or imagery, and sexual attention or advances of any kind
-
Trolling, insulting or derogatory comments, and personal or political attacks
-
Public or private harassment
-
Publishing others’ private information, such as a physical or email address, without their explicit permission
-
Other conduct which could reasonably be considered inappropriate in a professional setting
-
-
-
-
-Enforcement Responsibilities
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
-
-
-
-Scope
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
-
-
-
-Enforcement
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
-
-
-
-Enforcement Guidelines
-
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
-
-
-1. Correction
-
Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
-
Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
-
-
-
-2. Warning
-
Community Impact: A violation through a single incident or series of actions.
-
Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
-
-
-
-3. Temporary Ban
-
Community Impact: A serious violation of community standards, including sustained inappropriate behavior.
-
Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
-
-
-
-4. Permanent Ban
-
Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
-
Consequence: A permanent ban from any sort of public interaction within the community.
For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https:// www.contributor-covenant.org/translations.