From fc159dd47ba0fcdc8ca383d661fca09fcc9098eb Mon Sep 17 00:00:00 2001 From: topepo Date: Thu, 18 Oct 2018 11:13:04 -0400 Subject: [PATCH 1/9] version bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index e1635b0d1..c7c333099 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: parsnip -Version: 0.0.0.9003 +Version: 0.0.0.9004 Title: A Common API to Modeling and analysis Functions 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). Authors@R: c( From a987e74e57aa586d76617ea5ecb0fde1f34005da Mon Sep 17 00:00:00 2001 From: topepo Date: Thu, 18 Oct 2018 11:13:16 -0400 Subject: [PATCH 2/9] version bump and change update --- NEWS.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 523583198..b8bfad6f6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,13 @@ +# parsnip 0.0.0.9004 + +* Arguments to modeling functions are now captured as quosures. +* `others` has been replaced by `...` +* Data descriptor names have beemn changed and are now functions. The descriptor definitions for "cols" and "preds" have been switched. + # parsnip 0.0.0.9003 * `regularization` was changed to `penalty` in a few models to be consistent with [this change](tidymodels/model-implementation-principles@08d3afd). -* if a mode is not chosen in the model specification, it is assigned at the time of fit. [51](https://github.com/topepo/parsnip/issues/51) +* If a mode is not chosen in the model specification, it is assigned at the time of fit. [51](https://github.com/topepo/parsnip/issues/51) * The underlying modeling packages now are loaded by namespace. There will be some exceptions noted in the documentation for each model. For example, in some `predict` methods, the `earth` package will need to be attached to be fully operational. # parsnip 0.0.0.9002 From c4a52a5805a0ddbd63e2b5921ca02dc3b27f0c4c Mon Sep 17 00:00:00 2001 From: topepo Date: Thu, 18 Oct 2018 11:14:04 -0400 Subject: [PATCH 3/9] Updates for quosure changes --- vignettes/articles/Scratch.Rmd | 48 ++++++++++++--------- vignettes/parsnip_Intro.Rmd | 77 ++++++++++++++++++---------------- 2 files changed, 70 insertions(+), 55 deletions(-) diff --git a/vignettes/articles/Scratch.Rmd b/vignettes/articles/Scratch.Rmd index e2920ef46..13eec180d 100644 --- a/vignettes/articles/Scratch.Rmd +++ b/vignettes/articles/Scratch.Rmd @@ -64,14 +64,14 @@ A row for "unknown" modes is not needed in this object. Now, we enumerate the _main arguments_ for each engine. `parsnip` standardizes the names of arguments across different models and engines. For example, random forest and boosting use multiple trees to create the ensemble. Instead of using different argument names, `parsnip` standardizes on `trees` and the underlying code translates to the actual arguments used by the different functions. -In our case, the MDA argument name will be "subclasses". +In our case, the MDA argument name will be "sub_classes". Here, the object name will have the suffix `_arg_key` and will have columns for the engines and rows for the arguments. The entries for the data frame are the actual arguments for each engine (and is `NA` when an engine doesn't have that argument). Ours: ```{r arg-key} mixture_da_arg_key <- data.frame( - mda = "subclasses", - row.names = "subclasses", + mda = "sub_classes", + row.names = "sub_classes", stringsAsFactors = FALSE ) ``` @@ -89,27 +89,25 @@ The internals of `parsnip` will use these objects during the creation of the mod This is a fairly simple function that can follow a basic template. The main arguments to our function will be: * The mode. If the model can do more than one mode, you might default this to "unknown". In our case, since it is only a classification model, it makes sense to default it to that mode. - * The argument names (`subclasses` here). These should be defaulted to `NULL`. - * An argument, `others`, that can be used to pass in other arguments to the underlying model fit functions. - * `...`, although they are not currently used. We encourage developers to move the `...` after mode so that users are encouraged to use named arguments to the model specification. + * The argument names (`sub_classes` here). These should be defaulted to `NULL`. + * `...` is used to pass in other arguments to the underlying model fit functions. A basic version of the function is: ```{r model-fun} mixture_da <- - function(mode = "classification", ..., subclasses = NULL, others = list()) { - - # start with some basic error traps - check_empty_ellipse(...) - + function(mode = "classification", sub_classes = NULL, ...) { + # Check for correct mode if (!(mode %in% mixture_da_modes)) stop("`mode` should be one of: ", paste0("'", mixture_da_modes, "'", collapse = ", "), call. = FALSE) - args <- list(subclasses = subclasses) - - # save the other arguments but remove them if they are null. + # Capture the arguments in quosures + others <- enquos(...) + args <- list(sub_classes = enquo(sub_classes)) + + # Save the other arguments but remove them if they are null. no_value <- !vapply(others, is.null, logical(1)) others <- others[no_value] @@ -233,7 +231,7 @@ For example: library(parsnip) library(tidyverse) -mixture_da(subclasses = 2) %>% +mixture_da(sub_classes = 2) %>% translate(engine = "mda") ``` @@ -248,7 +246,7 @@ iris_split <- initial_split(iris, prop = 0.90) iris_train <- training(iris_split) iris_test <- testing(iris_split) -mda_spec <- mixture_da(subclasses = 2) +mda_spec <- mixture_da(sub_classes = 2) mda_fit <- mda_spec %>% fit(Species ~ ., data = iris_train, engine = "mda") @@ -278,7 +276,7 @@ There are some models (e.g. `glmnet`, `plsr`, `Cubist`, etc.) that can make pred For example, if I fit a linear regression model via `glmnet` and get four values of the regularization parameter (`lambda`): ```{r glmnet} -linear_reg(others = list(nlambda = 4)) %>% +linear_reg(nlambda = 4) %>% fit(mpg ~ ., data = mtcars, engine = "glmnet") %>% predict(new_data = mtcars[1:3, -1]) ``` @@ -302,7 +300,7 @@ logistic_reg() %>% translate(engine = "glm") # but you can change it: -logistic_reg(others = list(family = expr(binomial(link = "probit")))) %>% +logistic_reg(family = binomial(link = "probit")) %>% translate(engine = "glm") ``` @@ -322,13 +320,23 @@ translate.rand_forest <- function (x, engine, ...){ # Run the general method to get the real arguments in place x <- translate.default(x, engine, ...) + # Make code easier to read + arg_vals <- x$method$fit$args + # Check and see if they make sense for the engine and/or mode: if (x$engine == "ranger") { - if (any(names(x$method$fit$args) == "importance")) - if (is.logical(x$method$fit$args$importance)) + if (any(names(arg_vals) == "importance")) + # We want to check the type of `importance` but it is a quosure. We first + # get the expression. It is is logical, the value of `quo_get_expr` will + # not be an expression but the actual logical. The wrapping of `isTRUE` + # is there in case it is not an atomic value. + if (isTRUE(is.logical(quo_get_expr(arg_vals$importance)))) stop("`importance` should be a character value. See ?ranger::ranger.", call. = FALSE) + if (x$mode == "classification" && !any(names(arg_vals) == "probability")) + arg_vals$probability <- TRUE } + x$method$fit$args <- arg_vals x } ``` diff --git a/vignettes/parsnip_Intro.Rmd b/vignettes/parsnip_Intro.Rmd index c00efc499..7fa9a9d6d 100644 --- a/vignettes/parsnip_Intro.Rmd +++ b/vignettes/parsnip_Intro.Rmd @@ -77,24 +77,23 @@ The arguments to the default function are: args(rand_forest) ``` -However, there might be other arguments that you would like to change or allow to vary. These are accessible using the `others` option. This is a named list of arguments in the form of the underlying function being called. For example, `ranger` has an option to set the internal random number seed. To set this to a specific value: +However, there might be other arguments that you would like to change or allow to vary. These are accessible using the `...` slot. This is a named list of arguments in the form of the underlying function being called. For example, `ranger` has an option to set the internal random number seed. To set this to a specific value: ```{r rf-seed} rf_with_seed <- rand_forest( - trees = 2000, mtry = varying(), - others = list(seed = 63233), + trees = 2000, + mtry = varying(), + seed = 63233, mode = "regression" ) rf_with_seed ``` -If the model function contains the ellipses (`...`), these additional arguments can be passed along using `others`. - ### Process To fit the model, you must: -* define the model, including the _mode_, +* have a defined model, including the _mode_, * have no `varying()` parameters, and * specify a computational engine. @@ -123,44 +122,52 @@ translate(rf_with_seed, engine = "randomForest") These models can be fit using the `fit` function. Only the model object is returned. -```r +```{r, eval = FALSE} fit(rf_mod, mpg ~ ., data = mtcars, engine = "ranger") ``` ``` -## parsnip model object -## -## Ranger result -## -## Call: -## ranger::ranger(formula = mpg ~ ., data = mtcars, num.trees = 2000, num.threads = 1, verbose = FALSE, seed = sample.int(10^5, 1)) -## -## Type: Regression -## Number of trees: 2000 -## Sample size: 32 -## Number of independent variables: 10 -## Mtry: 3 -## Target node size: 5 -## Variable importance mode: none -## Splitrule: variance -## OOB prediction error (MSE): 5.71 -## R squared (OOB): 0.843 +#> parsnip model object +#> +#> Ranger result +#> +#> Call: +#> ranger::ranger(formula = formula, data = data, num.trees = ~2000, num.threads = 1, verbose = FALSE, seed = sample.int(10^5, 1)) +#> +#> Type: Regression +#> Number of trees: 2000 +#> Sample size: 32 +#> Number of independent variables: 10 +#> Mtry: 3 +#> Target node size: 5 +#> Variable importance mode: none +#> Splitrule: variance +#> OOB prediction error (MSE): 5.71 +#> R squared (OOB): 0.843 ``` -```r +```{r, eval = FALSE} fit(rf_mod, mpg ~ ., data = mtcars, engine = "randomForest") ``` ``` -## parsnip model object -## -## Call: -## randomForest(x = as.data.frame(x), y = y, ntree = 2000) -## Type of random forest: regression -## Number of trees: 2000 -## No. of variables tried at each split: 3 -## -## Mean of squared residuals: 5.6 -## % Var explained: 84.1 +#> parsnip model object +#> +#> +#> Call: +#> randomForest(x = as.data.frame(x), y = y, ntree = ~2000) +#> Type of random forest: regression +#> Number of trees: 2000 +#> No. of variables tried at each split: 3 +#> +#> Mean of squared residuals: 5.6 +#> % Var explained: 84.1 ``` + +Note that, in the case of the `ranger` fit, the call object shows `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. + From 5db068de1e44fea2edfdd32eab51c4844590c129 Mon Sep 17 00:00:00 2001 From: topepo Date: Thu, 18 Oct 2018 11:14:28 -0400 Subject: [PATCH 4/9] descriptor name changes --- NAMESPACE | 10 +- R/descriptors.R | 142 +++--- docs/articles/articles/Classification.html | 50 +- docs/articles/articles/Models.html | 6 +- docs/articles/articles/Regression.html | 64 +-- docs/articles/articles/Scratch.html | 134 +++--- docs/articles/index.html | 2 +- docs/articles/parsnip_Intro.html | 94 ++-- docs/authors.html | 2 +- docs/index.html | 4 +- docs/news/index.html | 16 +- docs/reference/C5.0_train.html | 197 ++++++++ docs/reference/boost_tree.html | 73 +-- docs/reference/check_empty_ellipse.html | 2 +- docs/reference/descriptors.html | 83 ++-- docs/reference/fit.html | 12 +- docs/reference/fit_control.html | 2 +- docs/reference/index.html | 4 +- docs/reference/keras_mlp.html | 199 ++++++++ docs/reference/lending_club.html | 2 +- docs/reference/linear_reg.html | 72 ++- docs/reference/logistic_reg.html | 75 ++- docs/reference/make_classes.html | 2 +- docs/reference/mars.html | 43 +- docs/reference/mlp.html | 50 +- docs/reference/model_fit.html | 2 +- docs/reference/model_printer.html | 2 +- docs/reference/model_spec.html | 2 +- docs/reference/multi_predict.html | 2 +- docs/reference/multinom_reg.html | 70 ++- docs/reference/nearest_neighbor.html | 48 +- docs/reference/other_predict.html | 2 +- docs/reference/predict.model_fit.html | 50 +- docs/reference/rand_forest.html | 75 ++- docs/reference/reexports.html | 2 +- docs/reference/set_args.html | 2 +- docs/reference/show_call.html | 2 +- docs/reference/surv_reg.html | 31 +- docs/reference/translate.html | 2 +- docs/reference/type_sum.model_spec.html | 2 +- docs/reference/varying.html | 2 +- docs/reference/varying_args.html | 81 ++-- docs/reference/wa_churn.html | 2 +- docs/reference/xgb_train.html | 201 ++++++++ man/descriptors.Rd | 66 +-- tests/testthat/test_descriptors.R | 22 +- tests/testthat/test_rand_forest_ranger.R | 18 +- vignettes/articles/Regression.Rmd | 10 +- vignettes/parsnip_Intro.html | 536 +++++++++++++++++++++ 49 files changed, 1865 insertions(+), 707 deletions(-) create mode 100644 docs/reference/C5.0_train.html create mode 100644 docs/reference/keras_mlp.html create mode 100644 docs/reference/xgb_train.html create mode 100644 vignettes/parsnip_Intro.html diff --git a/NAMESPACE b/NAMESPACE index c24da566c..1a9dc2bc8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -58,12 +58,12 @@ S3method(varying_args,model_spec) S3method(varying_args,recipe) S3method(varying_args,step) export("%>%") +export(.cols) export(.dat) -export(.n_cols) -export(.n_facts) -export(.n_levs) -export(.n_obs) -export(.n_preds) +export(.facts) +export(.lvls) +export(.obs) +export(.preds) export(.x) export(.y) export(C5.0_train) diff --git a/R/descriptors.R b/R/descriptors.R index 85444a776..9fa1b1872 100644 --- a/R/descriptors.R +++ b/R/descriptors.R @@ -1,21 +1,21 @@ #' @name descriptors -#' @aliases descriptors .n_obs .n_cols .n_preds .n_facts .n_levs .x .y .dat +#' @aliases descriptors .obs .cols .preds .facts .lvls .x .y .dat #' @title Data Set Characteristics Available when Fitting Models #' @description When using the `fit()` functions there are some #' variables that will be available for use in arguments. For #' example, if the user would like to choose an argument value -#' based on the current number of rows in a data set, the `.n_obs()` +#' based on the current number of rows in a data set, the `.obs()` #' function can be used. See Details below. #' @details #' Existing functions: #' \itemize{ -#' \item `.n_obs()`: The current number of rows in the data set. -#' \item `.n_cols()`: The number of columns in the data set that are +#' \item `.obs()`: The current number of rows in the data set. +#' \item `.cols()`: The number of columns in the data set that are #' associated with the predictors prior to dummy variable creation. -#' \item `.n_preds()`: The number of predictors after dummy variables +#' \item `.preds()`: The number of predictors after dummy variables #' are created (if any). -#' \item `.n_facts()`: The number of factor predictors in the dat set. -#' \item `.n_levs()`: If the outcome is a factor, this is a table +#' \item `.facts()`: The number of factor predictors in the dat set. +#' \item `.lvls()`: If the outcome is a factor, this is a table #' with the counts for each level (and `NA` otherwise). #' \item `.x()`: The predictors returned in the format given. Either a #' data frame or a matrix. @@ -29,26 +29,26 @@ #' For example, if you use the model formula `Sepal.Width ~ .` with the `iris` #' data, the values would be #' \preformatted{ -#' .n_cols() = 4 (the 4 columns in `iris`) -#' .n_preds() = 5 (3 numeric columns + 2 from Species dummy variables) -#' .n_obs() = 150 -#' .n_levs() = NA (no factor outcome) -#' .n_facts() = 1 (the Species predictor) -#' .y() = (Sepal.Width as a vector) -#' .x() = (The other 4 columns as a data frame) -#' .dat() = (The full data set) +#' .cols() = 4 (the 4 columns in `iris`) +#' .preds() = 5 (3 numeric columns + 2 from Species dummy variables) +#' .obs() = 150 +#' .lvls() = NA (no factor outcome) +#' .facts() = 1 (the Species predictor) +#' .y() = (Sepal.Width as a vector) +#' .x() = (The other 4 columns as a data frame) +#' .dat() = (The full data set) #' } #' #' If the formula `Species ~ .` where used: #' \preformatted{ -#' .n_cols() = 4 (the 4 numeric columns in `iris`) -#' .n_preds() = 4 (same) -#' .n_obs() = 150 -#' .n_levs() = c(setosa = 50, versicolor = 50, virginica = 50) -#' .n_facts() = 0 -#' .y() = (Species as a vector) -#' .x() = (The other 4 columns as a data frame) -#' .dat() = (The full data set) +#' .cols() = 4 (the 4 numeric columns in `iris`) +#' .preds() = 4 (same) +#' .obs() = 150 +#' .lvls() = c(setosa = 50, versicolor = 50, virginica = 50) +#' .facts() = 0 +#' .y() = (Species as a vector) +#' .x() = (The other 4 columns as a data frame) +#' .dat() = (The full data set) #' } #' #' To use these in a model fit, pass them to a model specification. @@ -60,7 +60,7 @@ #' #' data("lending_club") #' -#' rand_forest(mode = "classification", mtry = .n_cols() - 2) +#' rand_forest(mode = "classification", mtry = .cols() - 2) #' } #' #' When no descriptors are found, the computation of the descriptor values @@ -70,23 +70,23 @@ NULL #' @export #' @rdname descriptors -.n_cols <- function() descr_env$.n_cols() +.cols <- function() descr_env$.cols() #' @export #' @rdname descriptors -.n_preds <- function() descr_env$.n_preds() +.preds <- function() descr_env$.preds() #' @export #' @rdname descriptors -.n_obs <- function() descr_env$.n_obs() +.obs <- function() descr_env$.obs() #' @export #' @rdname descriptors -.n_levs <- function() descr_env$.n_levs() +.lvls <- function() descr_env$.lvls() #' @export #' @rdname descriptors -.n_facts <- function() descr_env$.n_facts() +.facts <- function() descr_env$.facts() #' @export #' @rdname descriptors @@ -116,24 +116,24 @@ get_descr_df <- function(formula, data) { tmp_dat <- convert_form_to_xy_fit(formula, data, indicators = FALSE) if(is.factor(tmp_dat$y)) { - .n_levs <- function() { + .lvls <- function() { table(tmp_dat$y, dnn = NULL) } - } else .n_levs <- function() { NA } + } else .lvls <- function() { NA } - .n_cols <- function() { + .cols <- function() { ncol(tmp_dat$x) } - .n_preds <- function() { + .preds <- function() { ncol(convert_form_to_xy_fit(formula, data, indicators = TRUE)$x) } - .n_obs <- function() { + .obs <- function() { nrow(data) } - .n_facts <- function() { + .facts <- function() { sum(vapply(tmp_dat$x, is.factor, logical(1))) } @@ -150,11 +150,11 @@ get_descr_df <- function(formula, data) { } list( - .n_cols = .n_cols, - .n_preds = .n_preds, - .n_obs = .n_obs, - .n_levs = .n_levs, - .n_facts = .n_facts, + .cols = .cols, + .preds = .preds, + .obs = .obs, + .lvls = .lvls, + .facts = .facts, .dat = .dat, .x = .x, .y = .y @@ -233,11 +233,11 @@ get_descr_spark <- function(formula, data) { obs <- dplyr::tally(data) %>% dplyr::pull() - .n_cols <- function() length(f_term_labels) - .n_preds <- function() all_preds - .n_obs <- function() obs - .n_levs <- function() y_vals - .n_facts <- function() factor_pred + .cols <- function() length(f_term_labels) + .preds <- function() all_preds + .obs <- function() obs + .lvls <- function() y_vals + .facts <- function() factor_pred .x <- function() abort("Descriptor `.x()` not defined for Spark.") .y <- function() abort("Descriptor `.y()` not defined for Spark.") .dat <- function() abort("Descriptor `.dat()` not defined for Spark.") @@ -245,11 +245,11 @@ get_descr_spark <- function(formula, data) { # still need .x(), .y(), .dat() ? list( - .n_cols = .n_cols, - .n_preds = .n_preds, - .n_obs = .n_obs, - .n_levs = .n_levs, - .n_facts = .n_facts, + .cols = .cols, + .preds = .preds, + .obs = .obs, + .lvls = .lvls, + .facts = .facts, .dat = .dat, .x = .x, .y = .y @@ -258,25 +258,25 @@ get_descr_spark <- function(formula, data) { get_descr_xy <- function(x, y) { - .n_levs <- if (is.factor(y)) { + .lvls <- if (is.factor(y)) { function() table(y, dnn = NULL) } else { function() NA } - .n_cols <- function() { + .cols <- function() { ncol(x) } - .n_preds <- function() { + .preds <- function() { ncol(x) } - .n_obs <- function() { + .obs <- function() { nrow(x) } - .n_facts <- function() { + .facts <- function() { if(is.data.frame(x)) sum(vapply(x, is.factor, logical(1))) else @@ -296,11 +296,11 @@ get_descr_xy <- function(x, y) { } list( - .n_cols = .n_cols, - .n_preds = .n_preds, - .n_obs = .n_obs, - .n_levs = .n_levs, - .n_facts = .n_facts, + .cols = .cols, + .preds = .preds, + .obs = .obs, + .lvls = .lvls, + .facts = .facts, .dat = .dat, .x = .x, .y = .y @@ -363,11 +363,11 @@ has_any_descrs <- function(x) { is_descr <- function(x) { descrs <- list( - ".n_cols", - ".n_preds", - ".n_obs", - ".n_levs", - ".n_facts", + ".cols", + ".preds", + ".obs", + ".lvls", + ".facts", ".x", ".y", ".dat" @@ -378,7 +378,7 @@ is_descr <- function(x) { # Helpers for overwriting descriptors temporarily ------------------------------ -# descrs = list of functions that actually eval to .n_cols() +# descrs = list of functions that actually eval to .cols() poke_descrs <- function(descrs) { descr_names <- names(descr_env) @@ -414,11 +414,11 @@ scoped_descrs <- function(descrs, frame = caller_env()) { # with their actual implementations descr_env <- rlang::new_environment( data = list( - .n_cols = function() abort("Descriptor context not set"), - .n_preds = function() abort("Descriptor context not set"), - .n_obs = function() abort("Descriptor context not set"), - .n_levs = function() abort("Descriptor context not set"), - .n_facts = function() abort("Descriptor context not set"), + .cols = function() abort("Descriptor context not set"), + .preds = function() abort("Descriptor context not set"), + .obs = function() abort("Descriptor context not set"), + .lvls = function() abort("Descriptor context not set"), + .facts = function() abort("Descriptor context not set"), .x = function() abort("Descriptor context not set"), .y = function() abort("Descriptor context not set"), .dat = function() abort("Descriptor context not set") diff --git a/docs/articles/articles/Classification.html b/docs/articles/articles/Classification.html index 9b3e6090c..de9664476 100644 --- a/docs/articles/articles/Classification.html +++ b/docs/articles/articles/Classification.html @@ -1,5 +1,5 @@ - + @@ -88,27 +88,29 @@

Classification Example

To demonstrate parsnip for classification models, the credit data will be used.

library(tidymodels)
 #> ── Attaching packages ──────────────────────────── tidymodels 0.0.1.9000 ──
-#> ✔ broom     0.5.0.9001      ✔ purrr     0.2.5      
-#> ✔ dials     0.0.1.9000      ✔ recipes   0.1.3.9002 
-#> ✔ dplyr     0.7.99.9000     ✔ rsample   0.0.2.9000 
-#> ✔ infer     0.3.1           ✔ yardstick 0.0.1.9000 
+#> ✔ broom     0.5.0.9001     ✔ purrr     0.2.5     
+#> ✔ dials     0.0.1.9000     ✔ recipes   0.1.3.9002
+#> ✔ dplyr     0.7.6          ✔ rsample   0.0.2     
+#> ✔ infer     0.3.1          ✔ yardstick 0.0.1.9000
 #> ✔ probably  0.0.0.9000
-#> ── Conflicts ──────────────────────────────────── tidymodels_conflicts() ──
-#> ✖ probably::as.factor()  masks base::as.factor()
-#> ✖ probably::as.ordered() masks base::as.ordered()
-#> ✖ purrr::discard()       masks scales::discard()
-#> ✖ rsample::fill()        masks tidyr::fill()
-#> ✖ dplyr::filter()        masks stats::filter()
-#> ✖ dplyr::lag()           masks stats::lag()
-#> ✖ recipes::step()        masks stats::step()
-
-data(credit_data)
+#> Warning: package 'dplyr' was built under R version 3.5.1
+#> ── Conflicts ──────────────────────────────────── tidymodels_conflicts() ──
+#> ✖ probably::as.factor()  masks base::as.factor()
+#> ✖ probably::as.ordered() masks base::as.ordered()
+#> ✖ purrr::discard()       masks scales::discard()
+#> ✖ rsample::fill()        masks tidyr::fill()
+#> ✖ dplyr::filter()        masks stats::filter()
+#> ✖ dplyr::lag()           masks stats::lag()
+#> ✖ rsample::prepper()     masks recipes::prepper()
+#> ✖ recipes::step()        masks stats::step()
 
-set.seed(7075)
-data_split <- initial_split(credit_data, strata = "Status", p = 0.75)
-
-credit_train <- training(data_split)
-credit_test  <- testing(data_split)
+data(credit_data) + +set.seed(7075) +data_split <- initial_split(credit_data, strata = "Status", p = 0.75) + +credit_train <- training(data_split) +credit_test <- testing(data_split)

A single hidden layer neural network will be used to predict a person’s credit status. To do so, the columns of the predictor matrix should be numeric and on a common scale. recipes will be used to do so.

+#> bad 174 72 +#> good 139 728

parsnip contains wrappers for a number of models. For example, the parsnip function rand_forest() can be used to create a random forest model. The mode of a model is related to its goal. Examples would be regression and classification.

The list of models accessible via parsnip is:

- +
mode @@ -187,7 +187,7 @@

List of Models

How the model is created is related to the engine. In many cases, this is an R modeling package. In others, it may be a connection to an external system (such as Spark or Tensorflow). This table lists the engines for each model type along with the type of prediction that it can make (see predict.model_fit()).

- +
model diff --git a/docs/articles/articles/Regression.html b/docs/articles/articles/Regression.html index 06e92b861..902abeee6 100644 --- a/docs/articles/articles/Regression.html +++ b/docs/articles/articles/Regression.html @@ -1,5 +1,5 @@ - + @@ -91,27 +91,29 @@

Regression Example

library(tidymodels) #> ── Attaching packages ──────────────────────────── tidymodels 0.0.1.9000 ── -#> ✔ broom 0.5.0.9001 ✔ purrr 0.2.5 -#> ✔ dials 0.0.1.9000 ✔ recipes 0.1.3.9002 -#> ✔ dplyr 0.7.99.9000 ✔ rsample 0.0.2.9000 -#> ✔ infer 0.3.1 ✔ tibble 1.4.2 -#> ✔ probably 0.0.0.9000 ✔ yardstick 0.0.1.9000 -#> ── Conflicts ──────────────────────────────────── tidymodels_conflicts() ── -#> ✖ probably::as.factor() masks base::as.factor() -#> ✖ probably::as.ordered() masks base::as.ordered() -#> ✖ dplyr::combine() masks randomForest::combine() -#> ✖ purrr::discard() masks scales::discard() -#> ✖ rsample::fill() masks tidyr::fill() -#> ✖ dplyr::filter() masks stats::filter() -#> ✖ dplyr::lag() masks stats::lag() -#> ✖ ggplot2::margin() masks randomForest::margin() -#> ✖ recipes::step() masks stats::step() - -set.seed(4595) -data_split <- initial_split(ames, strata = "Sale_Price", p = 0.75) - -ames_train <- training(data_split) -ames_test <- testing(data_split) +#> ✔ broom 0.5.0.9001 ✔ purrr 0.2.5 +#> ✔ dials 0.0.1.9000 ✔ recipes 0.1.3.9002 +#> ✔ dplyr 0.7.6 ✔ rsample 0.0.2 +#> ✔ infer 0.3.1 ✔ tibble 1.4.2 +#> ✔ probably 0.0.0.9000 ✔ yardstick 0.0.1.9000 +#> Warning: package 'dplyr' was built under R version 3.5.1 +#> ── Conflicts ──────────────────────────────────── tidymodels_conflicts() ── +#> ✖ probably::as.factor() masks base::as.factor() +#> ✖ probably::as.ordered() masks base::as.ordered() +#> ✖ dplyr::combine() masks randomForest::combine() +#> ✖ purrr::discard() masks scales::discard() +#> ✖ rsample::fill() masks tidyr::fill() +#> ✖ dplyr::filter() masks stats::filter() +#> ✖ dplyr::lag() masks stats::lag() +#> ✖ ggplot2::margin() masks randomForest::margin() +#> ✖ rsample::prepper() masks recipes::prepper() +#> ✖ recipes::step() masks stats::step() + +set.seed(4595) +data_split <- initial_split(ames, strata = "Sale_Price", p = 0.75) + +ames_train <- training(data_split) +ames_test <- testing(data_split)

Random Forests

@@ -198,7 +200,7 @@

#> Ranger result #> #> Call: -#> ranger::ranger(formula = formula, data = data, mtry = 3, num.trees = 1000, num.threads = 1, verbose = FALSE, seed = sample.int(10^5, 1)) +#> ranger::ranger(formula = formula, data = data, mtry = ~3, num.trees = ~1000, num.threads = 1, verbose = FALSE, seed = sample.int(10^5, 1)) #> #> Type: Regression #> Number of trees: 1000 @@ -221,7 +223,7 @@

#> #> #> Call: -#> randomForest(x = as.data.frame(x), y = y, ntree = 1000, mtry = 3) +#> randomForest(x = as.data.frame(x), y = y, ntree = ~1000, mtry = ~3) #> Type of random forest: regression #> Number of trees: 1000 #> No. of variables tried at each split: 3 @@ -234,13 +236,13 @@

Two relevant descriptors for what we are about to do are:

  • -n_cols: the number of columns in the data set that are associated with the predictors prior to dummy variable creation.
  • +.cols(): the number of columns in the data set that are associated with the predictors prior to dummy variable creation.
  • -n_preds: the number of predictors after dummy variables are created (if any).
  • +.preds(): the number of predictors after dummy variables are created (if any).
-

Since ranger won’t create indicator values, n_cols would be appropriate for using mtry for a bagging model.

-

For example, let’s use an expression with the n_cols descriptor to fit a bagging model:

-
rand_forest(mode = "regression", mtry = expr(n_cols), trees = 1000) %>%
+

Since ranger won’t create indicator values, .cols() would be appropriate for using mtry for a bagging model.

+

For example, let’s use an expression with the .cols() descriptor to fit a bagging model:

+ diff --git a/docs/articles/articles/Scratch.html b/docs/articles/articles/Scratch.html index f49ab4ebf..aaf1e68f8 100644 --- a/docs/articles/articles/Scratch.html +++ b/docs/articles/articles/Scratch.html @@ -1,5 +1,5 @@ - + @@ -116,11 +116,11 @@

#> classification TRUE

A row for “unknown” modes is not needed in this object.

Now, we enumerate the main arguments for each engine. parsnip standardizes the names of arguments across different models and engines. For example, random forest and boosting use multiple trees to create the ensemble. Instead of using different argument names, parsnip standardizes on trees and the underlying code translates to the actual arguments used by the different functions.

-

In our case, the MDA argument name will be “subclasses”.

+

In our case, the MDA argument name will be “sub_classes”.

Here, the object name will have the suffix _arg_key and will have columns for the engines and rows for the arguments. The entries for the data frame are the actual arguments for each engine (and is NA when an engine doesn’t have that argument). Ours:

As an example of a model with multiple engines, here is the object for logistic regression:

@@ -136,36 +136,34 @@

This is a fairly simple function that can follow a basic template. The main arguments to our function will be:

  • The mode. If the model can do more than one mode, you might default this to “unknown”. In our case, since it is only a classification model, it makes sense to default it to that mode.
  • -
  • The argument names (subclasses here). These should be defaulted to NULL.
  • -
  • An argument, others, that can be used to pass in other arguments to the underlying model fit functions.
  • +
  • The argument names (sub_classes here). These should be defaulted to NULL.
  • -..., although they are not currently used. We encourage developers to move the ... after mode so that users are encouraged to use named arguments to the model specification.
  • +... is used to pass in other arguments to the underlying model fit functions.

A basic version of the function is:

+ function(mode = "classification", sub_classes = NULL, ...) { + # Check for correct mode + if (!(mode %in% mixture_da_modes)) + stop("`mode` should be one of: ", + paste0("'", mixture_da_modes, "'", collapse = ", "), + call. = FALSE) + + # Capture the arguments in quosures + others <- enquos(...) + args <- list(sub_classes = enquo(sub_classes)) + + # Save the other arguments but remove them if they are null. + no_value <- !vapply(others, is.null, logical(1)) + others <- others[no_value] + + out <- list(args = args, others = others, + mode = mode, method = NULL, engine = NULL) + + # set classes in the correct order + class(out) <- make_classes("mixture_da") + out + }

This is pretty simple since the data are not exposed to this function.

Let’s try it on the iris data:

library(rsample)
 library(tibble)
@@ -294,7 +292,7 @@ 

iris_train <- training(iris_split) iris_test <- testing(iris_split) -mda_spec <- mixture_da(subclasses = 2) +mda_spec <- mixture_da(sub_classes = 2) mda_fit <- mda_spec %>% fit(Species ~ ., data = iris_train, engine = "mda") @@ -302,19 +300,19 @@

#> parsnip model object #> #> Call: -#> mda::mda(formula = formula, data = data, subclasses = 2) +#> mda::mda(formula = formula, data = data, sub_classes = ~2) #> #> Dimension: 4 #> #> Percent Between-Group Variance Explained: #> v1 v2 v3 v4 -#> 97.0 98.9 100.0 100.0 +#> 94.9 97.9 99.8 100.0 #> #> Degrees of Freedom (per dimension): 5 #> #> Training Misclassification Error: 0.0221 ( N = 136 ) #> -#> Deviance: 12.6 +#> Deviance: 12.3 predict(mda_fit, new_data = iris_test) %>% bind_cols(iris_test %>% select(Species)) @@ -341,20 +339,20 @@

#> # A tibble: 14 x 4 #> .pred_setosa .pred_versicolor .pred_virginica Species #> <dbl> <dbl> <dbl> <fct> -#> 1 1.00e+ 0 9.82e-28 2.41e-59 setosa -#> 2 1.00e+ 0 1.84e-22 1.31e-52 setosa -#> 3 1.00e+ 0 1.12e-24 9.69e-56 setosa -#> 4 2.75e-31 10.00e- 1 4.57e- 6 versicolor -#> 5 7.07e-32 9.99e- 1 6.56e- 4 versicolor -#> 6 4.21e-18 10.00e- 1 2.55e- 9 versicolor -#> 7 3.54e-32 9.84e- 1 1.63e- 2 versicolor -#> 8 1.25e-33 10.00e- 1 1.25e- 4 versicolor -#> 9 1.79e-32 9.60e- 1 3.95e- 2 versicolor -#> 10 4.35e-29 9.97e- 1 3.21e- 3 versicolor -#> 11 3.16e-32 9.99e- 1 6.32e- 4 versicolor -#> 12 9.39e-48 3.12e- 1 6.88e- 1 virginica -#> 13 6.84e-42 3.21e- 1 6.79e- 1 virginica -#> 14 4.10e-42 1.47e- 1 8.53e- 1 virginica

+#> 1 1.00e+ 0 2.62e-32 7.10e-65 setosa +#> 2 1.00e+ 0 1.36e-25 2.36e-56 setosa +#> 3 1.00e+ 0 9.11e-29 1.33e-60 setosa +#> 4 1.76e-38 10.00e- 1 1.97e- 7 versicolor +#> 5 5.64e-36 9.95e- 1 5.03e- 3 versicolor +#> 6 6.84e-22 10.00e- 1 9.83e- 9 versicolor +#> 7 2.54e-37 9.22e- 1 7.83e- 2 versicolor +#> 8 2.70e-37 9.99e- 1 1.34e- 3 versicolor +#> 9 1.81e-37 8.06e- 1 1.94e- 1 versicolor +#> 10 9.83e-35 9.93e- 1 7.27e- 3 versicolor +#> 11 4.04e-37 9.97e- 1 3.00e- 3 versicolor +#> 12 1.93e-55 1.44e- 1 8.56e- 1 virginica +#> 13 1.21e-50 4.19e- 1 5.81e- 1 virginica +#> 14 2.08e-50 2.07e- 1 7.93e- 1 virginica

@@ -370,7 +368,7 @@

There are some models (e.g. glmnet, plsr, Cubist, etc.) that can make predictions for different models from the same fitted model object. We want to facilitate that here so that, for these cases, the current convention is to return a tibble with the prediction in a column called values and have extra columns for any parameters that define the different sub-models.

For example, if I fit a linear regression model via glmnet and get four values of the regularization parameter (lambda):

-
linear_reg(others = list(nlambda = 4)) %>%
+
+  # Make code easier to read
+  arg_vals <- x$method$fit$args
+  
+  # Check and see if they make sense for the engine and/or mode:
+  if (x$engine == "ranger") {
+    if (any(names(arg_vals) == "importance")) 
+      # We want to check the type of `importance` but it is a quosure. We first
+      # get the expression. It is is logical, the value of `quo_get_expr` will
+      # not be an expression but the actual logical. The wrapping of `isTRUE`
+      # is there in case it is not an atomic value. 
+      if (isTRUE(is.logical(quo_get_expr(arg_vals$importance)))) 
+        stop("`importance` should be a character value. See ?ranger::ranger.", 
+             call. = FALSE)
+    if (x$mode == "classification" && !any(names(arg_vals) ==  "probability")) 
+      arg_vals$probability <- TRUE
+  }
+  x$method$fit$args <- arg_vals
+  x
+}

As another example, nnet::nnet has an option for the final layer to be linear (called linout). If mode = "regression", that should probably be set to TRUE. You couldn’t do this with the args (described above) since you need the function translated first.

In cases where the model requires different defaults, the translate method can also be used. See the code for the mars function to see how to check and potentially switch arguments for classification models.

diff --git a/docs/articles/index.html b/docs/articles/index.html index 758637575..3669cb2a4 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -1,6 +1,6 @@ - + diff --git a/docs/articles/parsnip_Intro.html b/docs/articles/parsnip_Intro.html index bad1de08c..d9581bccb 100644 --- a/docs/articles/parsnip_Intro.html +++ b/docs/articles/parsnip_Intro.html @@ -1,5 +1,5 @@ - + @@ -139,31 +139,31 @@

The arguments to the default function are:

-

However, there might be other arguments that you would like to change or allow to vary. These are accessible using the others option. This is a named list of arguments in the form of the underlying function being called. For example, ranger has an option to set the internal random number seed. To set this to a specific value:

+

However, there might be other arguments that you would like to change or allow to vary. These are accessible using the ... slot. This is a named list of arguments in the form of the underlying function being called. For example, ranger has an option to set the internal random number seed. To set this to a specific value:

-

If the model function contains the ellipses (...), these additional arguments can be passed along using others.

+ trees = 2000, + mtry = varying(), + seed = 63233, + mode = "regression" +) +rf_with_seed +#> Random Forest Model Specification (regression) +#> +#> Main Arguments: +#> mtry = varying() +#> trees = 2000 +#> +#> Engine-Specific Arguments: +#> seed = 63233

Process

To fit the model, you must:

    -
  • define the model, including the mode,
  • +
  • have a defined model, including the mode,
  • have no varying() parameters, and
  • specify a computational engine.
@@ -238,34 +238,38 @@

Fitting the Model

These models can be fit using the fit function. Only the model object is returned.

fit(rf_mod, mpg ~ ., data = mtcars, engine = "ranger")
-
## parsnip model object
-## 
-## Ranger result
-## 
-## Call:
-##  ranger::ranger(formula = mpg ~ ., data = mtcars, num.trees = 2000,      num.threads = 1, verbose = FALSE, seed = sample.int(10^5, 1)) 
-## 
-## Type:                             Regression 
-## Number of trees:                  2000 
-## Sample size:                      32 
-## Number of independent variables:  10 
-## Mtry:                             3 
-## Target node size:                 5 
-## Variable importance mode:         none 
-## Splitrule:                        variance 
-## OOB prediction error (MSE):       5.71 
-## R squared (OOB):                  0.843
+
#> parsnip model object
+#> 
+#> Ranger result
+#> 
+#> Call:
+#>  ranger::ranger(formula = formula, data = data, num.trees = ~2000,      num.threads = 1, verbose = FALSE, seed = sample.int(10^5,          1)) 
+#> 
+#> Type:                             Regression 
+#> Number of trees:                  2000 
+#> Sample size:                      32 
+#> Number of independent variables:  10 
+#> Mtry:                             3 
+#> Target node size:                 5 
+#> Variable importance mode:         none 
+#> Splitrule:                        variance 
+#> OOB prediction error (MSE):       5.71 
+#> R squared (OOB):                  0.843
fit(rf_mod, mpg ~ ., data = mtcars, engine = "randomForest")
-
## parsnip model object
-## 
-## Call:
-##  randomForest(x = as.data.frame(x), y = y, ntree = 2000) 
-##                Type of random forest: regression
-##                      Number of trees: 2000
-## No. of variables tried at each split: 3
-## 
-##           Mean of squared residuals: 5.6
-##                     % Var explained: 84.1
+
#> parsnip model object
+#> 
+#> 
+#> Call:
+#>  randomForest(x = as.data.frame(x), y = y, ntree = ~2000) 
+#>                Type of random forest: regression
+#>                      Number of trees: 2000
+#> No. of variables tried at each split: 3
+#> 
+#>           Mean of squared residuals: 5.6
+#>                     % Var explained: 84.1
+

Note that, in the case of the ranger fit, the call object shows 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/authors.html b/docs/authors.html index 6b6eddfc4..b52cc7305 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -1,6 +1,6 @@ - + diff --git a/docs/index.html b/docs/index.html index e3c5f3ecc..9cd77f614 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,5 +1,5 @@ - + @@ -109,7 +109,7 @@
  • Harmonize the argument names (e.g. n.trees, ntrees, trees) so that users can remember a single name. This will help across model types too so that trees will be the same argument across random forest as well as boosting or bagging. To install it, use:
  • +install_github("topepo/parsnip") diff --git a/docs/news/index.html b/docs/news/index.html index f69f55c0b..df7371bc8 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -1,6 +1,6 @@ - + @@ -97,13 +97,24 @@

    Changelog

    +
    +

    +parsnip 0.0.0.9004

    +
      +
    • Arguments to modeling functions are now captured as quosures.
    • +
    • +others has been replaced by ... +
    • +
    • Data descriptor names have beemn changed and are now functions. The descriptor definitions for “cols” and “preds” have been switched.
    • +
    +

    parsnip 0.0.0.9003

    • regularization was changed to penalty in a few models to be consistent with this change.
    • -
    • if a mode is not chosen in the model specification, it is assigned at the time of fit. 51 +
    • If a mode is not chosen in the model specification, it is assigned at the time of fit. 51
    • The underlying modeling packages now are loaded by namespace. There will be some exceptions noted in the documentation for each model. For example, in some predict methods, the earth package will need to be attached to be fully operational.
    @@ -140,6 +151,7 @@

    Contents

    These arguments are converted to their specific names at the time that the model is fit. Other options and argument can be -set using the others argument. If left to their defaults +set using the ... slot. If left to their defaults here (NULL), the values are taken from the underlying model functions. If parameters need to be modified, update can be used in lieu of recreating the object from scratch.

    -
    boost_tree(mode = "unknown", ..., mtry = NULL, trees = NULL,
    +    
    boost_tree(mode = "unknown", mtry = NULL, trees = NULL,
       min_n = NULL, tree_depth = NULL, learn_rate = NULL,
    -  loss_reduction = NULL, sample_size = NULL, others = list())
    +  loss_reduction = NULL, sample_size = NULL, ...)
     
     # S3 method for boost_tree
     update(object, mtry = NULL, trees = NULL,
       min_n = NULL, tree_depth = NULL, learn_rate = NULL,
    -  loss_reduction = NULL, sample_size = NULL, others = list(),
    -  fresh = FALSE, ...)
    + loss_reduction = NULL, sample_size = NULL, fresh = FALSE, ...)

    Arguments

    @@ -143,11 +142,6 @@

    Arg

    - - - - @@ -187,9 +181,12 @@

    Arg each iteration while C5.0 samples once during traning.

    - - + + @@ -216,26 +213,45 @@

    Details
  • R: "xgboost", "C5.0"

  • Spark: "spark"

  • -

    Main parameter arguments (and those in others) can avoid +

    Main parameter arguments (and those in ...) can avoid evaluation until the underlying function is executed by wrapping the argument in rlang::expr() (e.g. mtry = expr(floor(sqrt(p)))).

    -

    Engines may have pre-set default arguments when executing the -model fit call. These can be changed by using the others + +

    Note

    + +

    For models created using the spark engine, there are +several differences to consider. First, only the formula +interface to via fit is available; using fit_xy will +generate an error. Second, the predictions will always be in a +spark table format. The names will be the same as documented but +without the dots. Third, there is no equivalent to factor +columns in spark tables so class predictions are returned as +character columns. Fourth, to retain the model object for a new +R session (via save), the model$fit element of the parsnip +object should be serialized via ml_save(object$fit) and +separately saved to disk. In a new session, the object can be +reloaded and reattached to the parsnip object.

    + +

    Engine Details

    + + +

    Engines may have pre-set default arguments when executing the +model fit call. These can be changed by using the ... argument to pass in the preferred values. For this type of model, the template of the fit calls are:

    xgboost classification

    -xgb_train(x = missing_arg(), y = missing_arg(), nthread = 1, 
    +parsnip::xgb_train(x = missing_arg(), y = missing_arg(), nthread = 1, 
         verbose = 0)
     

    xgboost regression

    -xgb_train(x = missing_arg(), y = missing_arg(), nthread = 1, 
    +parsnip::xgb_train(x = missing_arg(), y = missing_arg(), nthread = 1, 
         verbose = 0)
     

    C5.0 classification

    -C5.0_train(x = missing_arg(), y = missing_arg(), weights = missing_arg())
    +parsnip::C5.0_train(x = missing_arg(), y = missing_arg(), weights = missing_arg())
     

    spark classification

    @@ -248,21 +264,6 @@ 

    Details type = "regression", seed = sample.int(10^5, 1))

    -

    Note

    - -

    For models created using the spark engine, there are -several differences to consider. First, only the formula -interface to via fit is available; using fit_xy will -generate an error. Second, the predictions will always be in a -spark table format. The names will be the same as documented but -without the dots. Third, there is no equivalent to factor -columns in spark tables so class predictions are returned as -character columns. Fourth, to retain the model object for a new -R session (via save), the model$fit element of the parsnip -object should be serialized via ml_save(object$fit) and -separately saved to disk. In a new session, the object can be -reloaded and reattached to the parsnip object.

    -

    See also

    @@ -306,6 +307,8 @@

    Contents

  • Note
  • +
  • Engine Details
  • +
  • See also
  • Examples
  • diff --git a/docs/reference/check_empty_ellipse.html b/docs/reference/check_empty_ellipse.html index 7ac9e2526..7ed3a701f 100644 --- a/docs/reference/check_empty_ellipse.html +++ b/docs/reference/check_empty_ellipse.html @@ -1,6 +1,6 @@ - + diff --git a/docs/reference/descriptors.html b/docs/reference/descriptors.html index 20dc2a457..de411872d 100644 --- a/docs/reference/descriptors.html +++ b/docs/reference/descriptors.html @@ -1,6 +1,6 @@ - + @@ -100,53 +100,80 @@

    Data Set Characteristics Available when Fitting Models

    -

    When using the fit functions there are some +

    When using the fit() functions there are some variables that will be available for use in arguments. For example, if the user would like to choose an argument value -based on the current number of rows in a data set, the n_obs -variable can be used. See Details below.

    +based on the current number of rows in a data set, the .obs() +function can be used. See Details below.

    +
    .cols()
    +
    +.preds()
    +
    +.obs()
    +
    +.lvls()
    +
    +.facts()
    +
    +.x()
    +
    +.y()
    +
    +.dat()

    Details

    -

    Existing variables:

      -
    • n_obs: the current number of rows in the data set.

    • -
    • n_cols: the number of columns in the data set that are +

      Existing functions:

        +
      • .obs(): The current number of rows in the data set.

      • +
      • .cols(): The number of columns in the data set that are associated with the predictors prior to dummy variable creation.

      • -
      • n_preds: the number of predictors after dummy variables +

      • .preds(): The number of predictors after dummy variables are created (if any).

      • -
      • n_facts: the number of factor predictors in the dat set.

      • -
      • n_levs: If the outcome is a factor, this is a table -with the counts for each level (and NA otherwise)

      • +
      • .facts(): The number of factor predictors in the dat set.

      • +
      • .lvls(): If the outcome is a factor, this is a table +with the counts for each level (and NA otherwise).

      • +
      • .x(): The predictors returned in the format given. Either a +data frame or a matrix.

      • +
      • .y(): The known outcomes returned in the format given. Either +a vector, matrix, or data frame.

      • +
      • .dat(): A data frame containing all of the predictors and the +outcomes. If fit_xy() was used, the outcomes are attached as the +column, ..y.

      For example, if you use the model formula Sepal.Width ~ . with the iris data, the values would be

      - n_cols  =   4     (the 4 columns in `iris`)
      - n_preds =   5     (3 numeric columns + 2 from Species dummy variables)
      - n_obs   = 150
      - n_levs  =  NA     (no factor outcome)
      - n_facts =   1     (the Species predictor)
      + .cols()  =   4          (the 4 columns in `iris`)
      + .preds() =   5          (3 numeric columns + 2 from Species dummy variables)
      + .obs()   = 150
      + .lvls()  =  NA          (no factor outcome)
      + .facts() =   1          (the Species predictor)
      + .y()     = <vector>     (Sepal.Width as a vector)
      + .x()     = <data.frame> (The other 4 columns as a data frame)
      + .dat()   = <data.frame> (The full data set)
       

      If the formula Species ~ . where used:

      - n_cols  =   4     (the 4 numeric columns in `iris`)
      - n_preds =   4     (same)
      - n_obs   = 150
      - n_levs  =  c(setosa = 50, versicolor = 50, virginica = 50)
      - n_facts =   0
      + .cols()  =   4          (the 4 numeric columns in `iris`)
      + .preds() =   4          (same)
      + .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)
       
      -

      To use these in a model fit, either expression or rlang::expr can be -used to delay the evaluation of the argument value until the time when the -model is run via fit (and the variables listed above are available). +

      To use these in a model fit, pass them to a model specification. +The evaluation is delayed until the time when the +model is run via fit() (and the variables listed above are available). For example:

      -library(rlang)
           data("lending_club")
      -    rand_forest(mode = "classification", mtry = expr(n_cols - 2))
      +    rand_forest(mode = "classification", mtry = .cols() - 2)
       
      -

      When no instance of expr is found in any of the argument -values, the descriptor calculation code will not be executed.

      +

      When no descriptors are found, the computation of the descriptor values +is not executed.

      diff --git a/docs/reference/fit.html b/docs/reference/fit.html index 6d9009d87..90f05689a 100644 --- a/docs/reference/fit.html +++ b/docs/reference/fit.html @@ -1,6 +1,6 @@ - + @@ -201,8 +201,10 @@

      Examp
      # Although `glm` only has a formula interface, different # methods for specifying the model can be used -library(dplyr)
      #> -#> Attaching package: ‘dplyr’
      #> The following objects are masked from ‘package:stats’: +library(dplyr)
      #> Warning: package ‘dplyr’ was built under R version 3.5.1
      #> +#> Attaching package: ‘dplyr’
      #> The following object is masked from ‘package:testthat’: +#> +#> matches
      #> The following objects are masked from ‘package:stats’: #> #> filter, lag
      #> The following objects are masked from ‘package:base’: #> @@ -227,7 +229,7 @@

      Examp using_formula

      #> parsnip model object #> #> -#> Call: stats::glm(formula = formula, family = binomial, data = data) +#> Call: stats::glm(formula = formula, family = stats::binomial, data = data) #> #> Coefficients: #> (Intercept) funded_amnt int_rate @@ -238,7 +240,7 @@

      Examp #> Residual Deviance: 3698 AIC: 3704

      using_xy
      #> parsnip model object #> #> -#> Call: stats::glm(formula = formula, family = binomial, data = data) +#> Call: stats::glm(formula = formula, family = stats::binomial, data = data) #> #> Coefficients: #> (Intercept) funded_amnt int_rate diff --git a/docs/reference/fit_control.html b/docs/reference/fit_control.html index d62da0239..a227b9baa 100644 --- a/docs/reference/fit_control.html +++ b/docs/reference/fit_control.html @@ -1,6 +1,6 @@ - + diff --git a/docs/reference/index.html b/docs/reference/index.html index e21bb0810..9a584cd37 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -1,6 +1,6 @@ - + @@ -176,7 +176,7 @@

      descriptors

      +

      .cols() .preds() .obs() .lvls() .facts() .x() .y() .dat()

    diff --git a/docs/reference/keras_mlp.html b/docs/reference/keras_mlp.html new file mode 100644 index 000000000..782ec4813 --- /dev/null +++ b/docs/reference/keras_mlp.html @@ -0,0 +1,199 @@ + + + + + + + + +Simple interface to MLP models via keras — keras_mlp • parsnip + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + +
    + +
    +
    + + +
    + +

    Instead of building a keras model sequentially, keras_mlp can be used to +create a feedforward network with a single hidden layer. Regularization is +via either weight decay or dropout.

    + +
    + +
    keras_mlp(x, y, hidden_units = 5, decay = 0, dropout = 0,
    +  epochs = 20, act = "softmax", seeds = sample.int(10^5, size = 3),
    +  ...)
    + +

    Arguments

    +

    A single character string for the type of model. Possible values for this model are "unknown", "regression", or "classification".

    ...

    Used for method consistency. Any arguments passed to -the ellipses will result in an error. Use others instead.

    mtry
    others

    A named list of arguments to be used by the -underlying models (e.g., xgboost::xgb.train, etc.). .

    ...

    Other arguments to pass to the specific engine's +model fit function (see the Engine Details section below). This +should not include arguments defined by the main parameters to +this function. For the update function, the ellipses can +contain the primary arguments or any others.

    object

    Data Set Characteristics Available when Fitting Models

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    x

    A data frame or matrix of predictors

    y

    A vector (factor or numeric) or matrix (numeric) of outcome data.

    hidden_units

    An integer for the number of hidden units.

    decay

    A non-negative real number for the amount of weight decay. Either +this parameter or dropout can specified.

    dropout

    The proportion of parameters to set to zero. Either +this parameter or decay can specified.

    epochs

    An integer for the number of passes through the data.

    act

    A character string for the type of activation function between layers.

    seeds

    A vector of three positive integers to control randomness of the +calculations.

    ...

    Currently ignored.

    + +

    Value

    + +

    A keras model object.

    + + +
    + + + +
    +
    +

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +
    + +
    +

    Developed by Max Kuhn.

    +

    Site built by pkgdown.

    +
    + + + +
    + + + + + + + diff --git a/docs/reference/lending_club.html b/docs/reference/lending_club.html index 259bb6ed5..283518805 100644 --- a/docs/reference/lending_club.html +++ b/docs/reference/lending_club.html @@ -1,6 +1,6 @@ - + diff --git a/docs/reference/linear_reg.html b/docs/reference/linear_reg.html index 3ed1bf0cc..72abeb3a3 100644 --- a/docs/reference/linear_reg.html +++ b/docs/reference/linear_reg.html @@ -1,6 +1,6 @@ - + @@ -110,19 +110,18 @@

    General Interface for Linear Regression Models

    the model. 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 -set using the others argument. If left to their defaults +set using the ... slot. If left to their defaults here (NULL), the values are taken from the underlying model functions. If parameters need to be modified, update can be used in lieu of recreating the object from scratch.

    -
    linear_reg(mode = "regression", ..., penalty = NULL, mixture = NULL,
    -  others = list())
    +    
    linear_reg(mode = "regression", penalty = NULL, mixture = NULL, ...)
     
     # S3 method for linear_reg
     update(object, penalty = NULL, mixture = NULL,
    -  others = list(), fresh = FALSE, ...)
    + fresh = FALSE, ...)

    Arguments

    @@ -131,11 +130,6 @@

    Arg

    - - - - @@ -150,12 +144,12 @@

    Arg (the lasso) (glmnet and spark only).

    - - + + @@ -168,10 +162,6 @@

    Arg

    mode

    A single character string for the type of model. The only possible value for this model is "regression".

    ...

    Used for S3 method consistency. Any arguments passed to -the ellipses will result in an error. Use others instead.

    penalty
    others

    A named list of arguments to be used by the -underlying models (e.g., stats::lm, -rstanarm::stan_glm, etc.). These are not evaluated -until the model is fit and will be substituted into the model -fit expression.

    ...

    Other arguments to pass to the specific engine's +model fit function (see the Engine Details section below). This +should not include arguments defined by the main parameters to +this function. For the update function, the ellipses can +contain the primary arguments or any others.

    object
    -

    Value

    - -

    An updated model specification.

    -

    Details

    The data given to the function are not saved and are only used @@ -183,8 +173,27 @@

    Details
  • Stan: "stan"

  • Spark: "spark"

  • + +

    Note

    + +

    For models created using the spark engine, there are +several differences to consider. First, only the formula +interface to via fit is available; using fit_xy will +generate an error. Second, the predictions will always be in a +spark table format. The names will be the same as documented but +without the dots. Third, there is no equivalent to factor +columns in spark tables so class predictions are returned as +character columns. Fourth, to retain the model object for a new +R session (via save), the model$fit element of the parsnip +object should be serialized via ml_save(object$fit) and +separately saved to disk. In a new session, the object can be +reloaded and reattached to the parsnip object.

    + +

    Engine Details

    + +

    Engines may have pre-set default arguments when executing the -model fit call. These can be changed by using the others +model fit call. These can be changed by using the ... argument to pass in the preferred values. For this type of model, the template of the fit calls are:

    lm

    @@ -199,7 +208,7 @@

    Details

    stan

     rstanarm::stan_glm(formula = missing_arg(), data = missing_arg(), 
    -    weights = missing_arg(), family = "gaussian")
    +    weights = missing_arg(), family = stats::gaussian)
     

    spark

    @@ -222,21 +231,6 @@ 

    Details distribution (or posterior predictive distribution as appropriate) is returned.

    -

    Note

    - -

    For models created using the spark engine, there are -several differences to consider. First, only the formula -interface to via fit is available; using fit_xy will -generate an error. Second, the predictions will always be in a -spark table format. The names will be the same as documented but -without the dots. Third, there is no equivalent to factor -columns in spark tables so class predictions are returned as -character columns. Fourth, to retain the model object for a new -R session (via save), the model$fit element of the parsnip -object should be serialized via ml_save(object$fit) and -separately saved to disk. In a new session, the object can be -reloaded and reattached to the parsnip object.

    -

    See also

    @@ -271,12 +265,12 @@

    Contents

    These arguments are converted to their specific names at the time that the model is fit. Other options and argument can be -set using the others argument. If left to their defaults +set using the ... slot. If left to their defaults here (NULL), the values are taken from the underlying model functions. If parameters need to be modified, update can be used in lieu of recreating the object from scratch.

    -
    logistic_reg(mode = "classification", ..., penalty = NULL,
    -  mixture = NULL, others = list())
    +    
    logistic_reg(mode = "classification", penalty = NULL, mixture = NULL,
    +  ...)
     
     # S3 method for logistic_reg
     update(object, penalty = NULL, mixture = NULL,
    -  others = list(), fresh = FALSE, ...)
    + fresh = FALSE, ...)

    Arguments

    @@ -131,11 +131,6 @@

    Arg

    - - - - @@ -150,12 +145,12 @@

    Arg (the lasso) (glmnet and spark only).

    - - + + @@ -168,10 +163,6 @@

    Arg

    mode

    A single character string for the type of model. The only possible value for this model is "classification".

    ...

    Used for S3 method consistency. Any arguments passed to -the ellipses will result in an error. Use others instead.

    penalty
    others

    A named list of arguments to be used by the -underlying models (e.g., stats::glm, -rstanarm::stan_glm, etc.). These are not evaluated -until the model is fit and will be substituted into the model -fit expression.

    ...

    Other arguments to pass to the specific engine's +model fit function (see the Engine Details section below). This +should not include arguments defined by the main parameters to +this function. For the update function, the ellipses can +contain the primary arguments or any others.

    object
    -

    Value

    - -

    An updated model specification.

    -

    Details

    For logistic_reg, the mode will always be "classification".

    @@ -181,14 +172,33 @@

    Details
  • Stan: "stan"

  • Spark: "spark"

  • + +

    Note

    + +

    For models created using the spark engine, there are +several differences to consider. First, only the formula +interface to via fit is available; using fit_xy will +generate an error. Second, the predictions will always be in a +spark table format. The names will be the same as documented but +without the dots. Third, there is no equivalent to factor +columns in spark tables so class predictions are returned as +character columns. Fourth, to retain the model object for a new +R session (via save), the model$fit element of the parsnip +object should be serialized via ml_save(object$fit) and +separately saved to disk. In a new session, the object can be +reloaded and reattached to the parsnip object.

    + +

    Engine Details

    + +

    Engines may have pre-set default arguments when executing the -model fit call. These can be changed by using the others +model fit call. These can be changed by using the ... argument to pass in the preferred values. For this type of model, the template of the fit calls are:

    glm

     stats::glm(formula = missing_arg(), data = missing_arg(), weights = missing_arg(), 
    -    family = binomial)
    +    family = stats::binomial)
     

    glmnet

    @@ -198,7 +208,7 @@ 

    Details

    stan

     rstanarm::stan_glm(formula = missing_arg(), data = missing_arg(), 
    -    weights = missing_arg(), family = binomial)
    +    weights = missing_arg(), family = stats::binomial)
     

    spark

    @@ -222,21 +232,6 @@ 

    Details appropriate) is returned. For glm, the standard error is in logit units while the intervals are in probability units.

    -

    Note

    - -

    For models created using the spark engine, there are -several differences to consider. First, only the formula -interface to via fit is available; using fit_xy will -generate an error. Second, the predictions will always be in a -spark table format. The names will be the same as documented but -without the dots. Third, there is no equivalent to factor -columns in spark tables so class predictions are returned as -character columns. Fourth, to retain the model object for a new -R session (via save), the model$fit element of the parsnip -object should be serialized via ml_save(object$fit) and -separately saved to disk. In a new session, the object can be -reloaded and reattached to the parsnip object.

    -

    See also

    @@ -271,12 +266,12 @@

    Contents

    These arguments are converted to their specific names at the time that the model is fit. Other options and argument can be -set using the others argument. If left to their defaults +set using the ... slot. If left to their defaults here (NULL), the values are taken from the underlying model functions. If parameters need to be modified, update can be used in lieu of recreating the object from scratch.

    -
    mars(mode = "unknown", ..., num_terms = NULL, prod_degree = NULL,
    -  prune_method = NULL, others = list())
    +    
    mars(mode = "unknown", num_terms = NULL, prod_degree = NULL,
    +  prune_method = NULL, ...)
     
     # S3 method for mars
     update(object, num_terms = NULL, prod_degree = NULL,
    -  prune_method = NULL, others = list(), fresh = FALSE, ...)
    + prune_method = NULL, fresh = FALSE, ...)

    Arguments

    @@ -135,11 +135,6 @@

    Arg

    - - - - @@ -155,12 +150,12 @@

    Arg

    - - + + @@ -173,21 +168,21 @@

    Arg

    A single character string for the type of model. Possible values for this model are "unknown", "regression", or "classification".

    ...

    Used for method consistency. Any arguments passed to -the ellipses will result in an error. Use others instead.

    num_terms

    The pruning method.

    others

    A named list of arguments to be used by the -underlying models (e.g., earth::earth, etc.). If the outcome is a factor -and mode = "classification", others can include the glm argument to -earth::earth. If this argument is not passed, it will be added prior to -the fitting occurs.

    ...

    Other arguments to pass to the specific engine's +model fit function (see the Engine Details section below). This +should not include arguments defined by the main parameters to +this function. For the update function, the ellipses can +contain the primary arguments or any others.

    object
    -

    Value

    - -

    An updated model specification.

    -

    Details

    -

    Main parameter arguments (and those in others) can avoid +

    Main parameter arguments (and those in ...) can avoid evaluation until the underlying function is executed by wrapping the argument in rlang::expr().

    The model can be created using the fit() function using the following engines:

    • R: "earth"

    + +

    Engine Details

    + +

    Engines may have pre-set default arguments when executing the -model fit call. These can be changed by using the others +model fit call. These can be changed by using the ... argument to pass in the preferred values. For this type of model, the template of the fit calls are:

    earth classification

    @@ -236,10 +231,10 @@

    Contents

    -

    Main parameter arguments (and those in others) can avoid +

    Main parameter arguments (and those in ...) can avoid evaluation until the underlying function is executed by wrapping the argument in rlang::expr() (e.g. hidden_units = expr(num_preds * 2)).

    An error is thrown if both penalty and dropout are specified for keras models.

    -

    Engines may have pre-set default arguments when executing the -model fit call. These can be changed by using the others + +

    Engine Details

    + + +

    Engines may have pre-set default arguments when executing the +model fit call. These can be changed by using the ... argument to pass in the preferred values. For this type of model, the template of the fit calls are:

    keras classification

    -keras_mlp(x = missing_arg(), y = missing_arg())
    +parsnip::keras_mlp(x = missing_arg(), y = missing_arg())
     

    keras regression

    -keras_mlp(x = missing_arg(), y = missing_arg())
    +parsnip::keras_mlp(x = missing_arg(), y = missing_arg())
     

    nnet classification

    @@ -272,10 +268,10 @@ 

    Contents

    These arguments are converted to their specific names at the time that the model is fit. Other options and argument can be -set using the others argument. If left to their defaults +set using the ... slot. If left to their defaults here (NULL), the values are taken from the underlying model functions. If parameters need to be modified, update can be used in lieu of recreating the object from scratch.

    -
    multinom_reg(mode = "classification", ..., penalty = NULL,
    -  mixture = NULL, others = list())
    +    
    multinom_reg(mode = "classification", penalty = NULL, mixture = NULL,
    +  ...)
     
     # S3 method for multinom_reg
     update(object, penalty = NULL, mixture = NULL,
    -  others = list(), fresh = FALSE, ...)
    + fresh = FALSE, ...)

    Arguments

    @@ -131,11 +131,6 @@

    Arg

    - - - - @@ -150,11 +145,12 @@

    Arg (the lasso) (glmnet only).

    - - + + @@ -167,10 +163,6 @@

    Arg

    mode

    A single character string for the type of model. The only possible value for this model is "classification".

    ...

    Used for S3 method consistency. Any arguments passed to -the ellipses will result in an error. Use others instead.

    penalty
    others

    A named list of arguments to be used by the -underlying models (e.g., glmnet::glmnet etc.). These are not evaluated -until the model is fit and will be substituted into the model -fit expression.

    ...

    Other arguments to pass to the specific engine's +model fit function (see the Engine Details section below). This +should not include arguments defined by the main parameters to +this function. For the update function, the ellipses can +contain the primary arguments or any others.

    object
    -

    Value

    - -

    An updated model specification.

    -

    Details

    For multinom_reg, the mode will always be "classification".

    @@ -179,8 +171,27 @@

    Details
  • R: "glmnet"

  • Stan: "stan"

  • + +

    Note

    + +

    For models created using the spark engine, there are +several differences to consider. First, only the formula +interface to via fit is available; using fit_xy will +generate an error. Second, the predictions will always be in a +spark table format. The names will be the same as documented but +without the dots. Third, there is no equivalent to factor +columns in spark tables so class predictions are returned as +character columns. Fourth, to retain the model object for a new +R session (via save), the model$fit element of the parsnip +object should be serialized via ml_save(object$fit) and +separately saved to disk. In a new session, the object can be +reloaded and reattached to the parsnip object.

    + +

    Engine Details

    + +

    Engines may have pre-set default arguments when executing the -model fit call. These can be changed by using the others +model fit call. These can be changed by using the ... argument to pass in the preferred values. For this type of model, the template of the fit calls are:

    glmnet

    @@ -203,21 +214,6 @@

    Details multinom_reg, the predict method will return a data frame with columns values and lambda.

    -

    Note

    - -

    For models created using the spark engine, there are -several differences to consider. First, only the formula -interface to via fit is available; using fit_xy will -generate an error. Second, the predictions will always be in a -spark table format. The names will be the same as documented but -without the dots. Third, there is no equivalent to factor -columns in spark tables so class predictions are returned as -character columns. Fourth, to retain the model object for a new -R session (via save), the model$fit element of the parsnip -object should be serialized via ml_save(object$fit) and -separately saved to disk. In a new session, the object can be -reloaded and reattached to the parsnip object.

    -

    See also

    @@ -252,12 +248,12 @@

    Contents

    These arguments are converted to their specific names at the time that the model is fit. Other options and argument can be -set using the others argument. If left to their defaults +set using the ... slot. If left to their defaults here (NULL), the values are taken from the underlying model functions. If parameters need to be modified, update() can be used in lieu of recreating the object from scratch.

    -
    nearest_neighbor(mode = "unknown", ..., neighbors = NULL,
    -  weight_func = NULL, dist_power = NULL, others = list())
    +
    nearest_neighbor(mode = "unknown", neighbors = NULL,
    +  weight_func = NULL, dist_power = NULL, ...)

    Arguments

    @@ -131,11 +131,6 @@

    Arg

    - - - - @@ -155,11 +150,12 @@

    Arg calculating Minkowski distance.

    - - + +

    A single character string for the type of model. Possible values for this model are "unknown", "regression", or "classification".

    ...

    Used for S3 method consistency. Any arguments passed to -the ellipses will result in an error. Use others instead.

    neighbors
    others

    A named list of arguments to be used by the -underlying models (e.g., kknn::train.kknn). These are not evaluated -until the model is fit and will be substituted into the model -fit expression.

    ...

    Other arguments to pass to the specific engine's +model fit function (see the Engine Details section below). This +should not include arguments defined by the main parameters to +this function. For the update function, the ellipses can +contain the primary arguments or any others.

    @@ -169,15 +165,6 @@

    Details following engines:

    • R: "kknn"

    -

    Engines may have pre-set default arguments when executing the -model fit call. These can be changed by using the others -argument to pass in the preferred values. For this type of -model, the template of the fit calls are:

    -

    kknn (classification or regression)

    -

    -kknn::train.kknn(formula = missing_arg(), data = missing_arg(), 
    -    kmax = missing_arg())
    -

    Note

    @@ -187,6 +174,19 @@

    Note

    on new data. This also means that a single value of that function's kernel argument (a.k.a weight_func here) can be supplied

    +

    Engine Details

    + + +

    Engines may have pre-set default arguments when executing the +model fit call. These can be changed by using the ... +argument to pass in the preferred values. For this type of +model, the template of the fit calls are:

    +

    kknn (classification or regression)

    +

    +kknn::train.kknn(formula = missing_arg(), data = missing_arg(), 
    +    kmax = missing_arg())
    +

    +

    See also

    @@ -206,6 +206,8 @@

    Contents

  • Note
  • +
  • Engine Details
  • +
  • See also
  • Examples
  • diff --git a/docs/reference/other_predict.html b/docs/reference/other_predict.html index 2cf52f801..8ad154b48 100644 --- a/docs/reference/other_predict.html +++ b/docs/reference/other_predict.html @@ -1,6 +1,6 @@ - + diff --git a/docs/reference/predict.model_fit.html b/docs/reference/predict.model_fit.html index 23e72f2af..24e7cd00a 100644 --- a/docs/reference/predict.model_fit.html +++ b/docs/reference/predict.model_fit.html @@ -1,6 +1,6 @@ - + @@ -195,37 +195,37 @@

    Examp slice(1:10) %>% select(-mpg) -predict(lm_model, pred_cars)
    #> # A tibble: 10 x 1 +predict(lm_model, pred_cars)
    #> # A tibble: 10 x 1 #> .pred -#> <dbl> -#> 1 23.4 -#> 2 23.3 -#> 3 27.6 -#> 4 21.5 -#> 5 17.6 -#> 6 21.6 -#> 7 13.9 -#> 8 21.7 -#> 9 25.6 -#> 10 17.1
    +#> <dbl> +#>  1 23.4 +#>  2 23.3 +#>  3 27.6 +#>  4 21.5 +#>  5 17.6 +#>  6 21.6 +#>  7 13.9 +#>  8 21.7 +#>  9 25.6 +#> 10 17.1
    predict( lm_model, pred_cars, type = "conf_int", level = 0.90 -)
    #> # A tibble: 10 x 2 +)
    #> # A tibble: 10 x 2 #> .pred_lower .pred_upper -#> <dbl> <dbl> -#> 1 17.9 29.0 -#> 2 18.1 28.5 -#> 3 24.0 31.3 -#> 4 17.5 25.6 -#> 5 14.3 20.8 -#> 6 17.0 26.2 -#> 7 9.65 18.2 -#> 8 16.2 27.2 -#> 9 14.2 37.0 -#> 10 11.5 22.7
    +#> <dbl> <dbl> +#>  1 17.9 29.0 +#>  2 18.1 28.5 +#>  3 24.0 31.3 +#>  4 17.5 25.6 +#>  5 14.3 20.8 +#>  6 17.0 26.2 +#>  7 9.65 18.2 +#>  8 16.2 27.2 +#>  9 14.2 37.0 +#> 10 11.5 22.7
    predict( lm_model, pred_cars, diff --git a/docs/reference/rand_forest.html b/docs/reference/rand_forest.html index c6f5d68c0..6028f32a6 100644 --- a/docs/reference/rand_forest.html +++ b/docs/reference/rand_forest.html @@ -1,6 +1,6 @@ - + @@ -111,19 +111,19 @@

    General Interface for Random Forest Models

    that are required for the node to be split further.

    These arguments are converted to their specific names at the time that the model is fit. Other options and argument can be -set using the others argument. If left to their defaults +set using the ... slot. If left to their defaults here (NULL), the values are taken from the underlying model functions. If parameters need to be modified, update can be used in lieu of recreating the object from scratch.

    -
    rand_forest(mode = "unknown", ..., mtry = NULL, trees = NULL,
    -  min_n = NULL, others = list())
    +    
    rand_forest(mode = "unknown", mtry = NULL, trees = NULL,
    +  min_n = NULL, ...)
     
     # S3 method for rand_forest
     update(object, mtry = NULL, trees = NULL,
    -  min_n = NULL, others = list(), fresh = FALSE, ...)
    + min_n = NULL, fresh = FALSE, ...)

    Arguments

    @@ -133,11 +133,6 @@

    Arg

    - - - - @@ -155,10 +150,12 @@

    Arg in a node that are required for the node to be split further.

    - - + + @@ -171,10 +168,6 @@

    Arg

    A single character string for the type of model. Possible values for this model are "unknown", "regression", or "classification".

    ...

    Used for method consistency. Any arguments passed to -the ellipses will result in an error. Use others instead.

    mtry
    others

    A named list of arguments to be used by the -underlying models (e.g., ranger::ranger, -randomForest::randomForest, etc.). .

    ...

    Other arguments to pass to the specific engine's +model fit function (see the Engine Details section below). This +should not include arguments defined by the main parameters to +this function. For the update function, the ellipses can +contain the primary arguments or any others.

    object
    -

    Value

    - -

    An updated model specification.

    -

    Details

    The model can be created using the fit() function using the @@ -182,13 +175,32 @@

    Details
  • R: "ranger" or "randomForest"

  • Spark: "spark"

  • -

    Main parameter arguments (and those in others) can avoid +

    Main parameter arguments (and those in ...) can avoid evaluation until the underlying function is executed by wrapping the argument in rlang::expr() (e.g. mtry = expr(floor(sqrt(p)))).

    -

    Engines may have pre-set default arguments when executing the -model fit call. These can be changed by using the others + +

    Note

    + +

    For models created using the spark engine, there are +several differences to consider. First, only the formula +interface to via fit is available; using fit_xy will +generate an error. Second, the predictions will always be in a +spark table format. The names will be the same as documented but +without the dots. Third, there is no equivalent to factor +columns in spark tables so class predictions are returned as +character columns. Fourth, to retain the model object for a new +R session (via save), the model$fit element of the parsnip +object should be serialized via ml_save(object$fit) and +separately saved to disk. In a new session, the object can be +reloaded and reattached to the parsnip object.

    + +

    Engine Details

    + + +

    Engines may have pre-set default arguments when executing the +model fit call. These can be changed by using the ... argument to pass in the preferred values. For this type of -model, the template of the fit calls are:

    +model, the template of the fit calls are::

    ranger classification

     ranger::ranger(formula = missing_arg(), data = missing_arg(), 
    @@ -224,21 +236,6 @@ 

    Details classification probabilities, these values can fall outside of [0, 1] and will be coerced to be in this range.

    -

    Note

    - -

    For models created using the spark engine, there are -several differences to consider. First, only the formula -interface to via fit is available; using fit_xy will -generate an error. Second, the predictions will always be in a -spark table format. The names will be the same as documented but -without the dots. Third, there is no equivalent to factor -columns in spark tables so class predictions are returned as -character columns. Fourth, to retain the model object for a new -R session (via save), the model$fit element of the parsnip -object should be serialized via ml_save(object$fit) and -separately saved to disk. In a new session, the object can be -reloaded and reattached to the parsnip object.

    -

    See also

    @@ -276,12 +273,12 @@

    Contents

    This argument is converted to its specific names at the time that the model is fit. Other options and argument can be -set using the others argument. If left to its default +set using the ... slot. If left to its default here (NULL), the value is taken from the underlying model functions.

    If parameters need to be modified, this function can be used @@ -115,11 +115,10 @@

    General Interface for Parametric Survival Models

    -
    surv_reg(mode = "regression", ..., dist = NULL, others = list())
    +    
    surv_reg(mode = "regression", dist = NULL, ...)
     
     # S3 method for surv_reg
    -update(object, dist = NULL, others = list(),
    -  fresh = FALSE, ...)
    +update(object, dist = NULL, fresh = FALSE, ...)

    Arguments

    @@ -128,11 +127,6 @@

    Arg

    - - - - @@ -140,11 +134,12 @@

    Arg the default.

    - - + + @@ -157,10 +152,6 @@

    Arg

    mode

    A single character string for the type of model. The only possible value for this model is "regression".

    ...

    Used for S3 method consistency. Any arguments passed to -the ellipses will result in an error. Use others instead.

    dist
    others

    A named list of arguments to be used by the -underlying models (e.g., flexsurv::flexsurvreg). These are not evaluated -until the model is fit and will be substituted into the model -fit expression.

    ...

    Other arguments to pass to the specific engine's +model fit function (see the Engine Details section below). This +should not include arguments defined by the main parameters to +this function. For the update function, the ellipses can +contain the primary arguments or any others.

    object
    -

    Value

    - -

    An updated model specification.

    -

    Details

    The data given to the function are not saved and are only used @@ -211,8 +202,6 @@

    Contents

    +#> bad 177 73 +#> good 136 727
    diff --git a/docs/articles/articles/Models.html b/docs/articles/articles/Models.html index 1ff9e0bcf..eaf888ecd 100644 --- a/docs/articles/articles/Models.html +++ b/docs/articles/articles/Models.html @@ -8,18 +8,29 @@ List of Models • parsnip - - + + + + + +
    +

    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.

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - -
    + diff --git a/docs/authors.html b/docs/authors.html index b52cc7305..8d9ef5f2d 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -18,18 +18,38 @@ - + + + + + + + - + + + + + - + + + + + @@ -38,7 +58,8 @@ @@ -114,22 +139,15 @@

    Authors

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/favicon.ico b/docs/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..19c6431bc8c9ea5d80d6847b781253eacc4d571f GIT binary patch literal 1408 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyk|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m{l@EB1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`f(~1RD^r68eAMwS&*t9 zlvO-#Mv>2~2MaLa!rEy`aR9TL84#CABECEH%ZgC_h&L>}jh^+-@<)X&zK> z3U0Sp;MA)Rbc{YIYLTKECIn1BASOKF0y*%cpPC0u??u3box0^XD3=`z@Ck8MmRFDz z6;qOvmk<&C|Np;?gyfemU*x2uCry|jE-WG{C?qc}BPAv-Ehhf(;lr0NUp{>B;N81- zB}GNaiAfE0_3z)kdj$k9UnV#2QI=DX6cG*d^?UyOxul3#OH-4$kZ^uZ?)&%e@7}#z zTv#M0EmKuqQBhJVB`W^l{{6Ra---zdfBN__BQ;fCT6)@)sT2Dr0G)lld&e}OkDN+^ z{DOg8$^e6lm;k8Ixa8^L7*cWT&E(@^O$Gw4>Ow-Zf?VG0{eDmT|Nmg6Ig4F7@?w9K zo!pzAX3QU>cD3?$V!gs2g}ZE_#eZ4d6)r8E!6309@nDZ&hYKtJZ$~HH&uSBH|LUw= znm${x(L<}bmX)=;LH3+R(_7u9%b~qT4^DZ>SR^c0m*W0V_}eGe|DU5B=lX|;EZ8&A zR4?pY_4_BAuIWhjU)Ge7S$l7aa@UM}$seWPes#sFXob~$=a{ZqRK@lA*4tf=FJ*MjoWGlanZZEI@xAS;)cYXsdAjA Common API to Modeling and analysis Functions • parsnip - - + + + + + +

    @@ -140,21 +154,16 @@

    Developers

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - -
    + diff --git a/docs/news/index.html b/docs/news/index.html index df7371bc8..717d172b1 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -18,18 +18,38 @@ - + + + + + + + - + + + + + - + + + + + @@ -38,7 +58,8 @@ @@ -164,22 +189,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/pkgdown.css b/docs/pkgdown.css index d1dc62d87..6ca2f37ab 100644 --- a/docs/pkgdown.css +++ b/docs/pkgdown.css @@ -1,146 +1,139 @@ -img.icon { - float: left; - margin-left: -35px; - width: 30px; - height: 30px; -} - -body {font-size: 16px;} -h1 {font-size: 40px;} -h2 {font-size: 30px;} - -/* Fixes for fixed navbar --------------------------*/ +/* Sticky footer */ + +/** + * Basic idea: https://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/ + * Details: https://github.com/philipwalton/solved-by-flexbox/blob/master/assets/css/components/site.css + * + * .Site -> body > .container + * .Site-content -> body > .container .row + * .footer -> footer + * + * Key idea seems to be to ensure that .container and __all its parents__ + * have height set to 100% + * + */ + +html, body { + height: 100%; +} + +body > .container { + display: flex; + height: 100%; + flex-direction: column; -body { - position: relative; - padding-top: 65px; + padding-top: 60px; } -.contents h1, .contents h2, .contents h3, .contents h4 { - padding-top: 65px; - margin-top: -45px; +body > .container .row { + flex: 1 0 auto; } -.page-header { - margin-top: 0; - margin-bottom: 10px; - padding-bottom: 0px; +footer { + margin-top: 45px; + padding: 35px 0 36px; + border-top: 1px solid #e5e5e5; + color: #666; + display: flex; + flex-shrink: 0; } - -/* Static header placement on mobile devices */ -@media (max-width: 767px) { - .navbar-fixed-top { - position: absolute; - } +footer p { + margin-bottom: 0; } - -.navbar-toggle { - margin-top: 8px; - margin-bottom: 5px; +footer div { + flex: 1; } - -.navbar-nav li a { - padding-bottom: 10px; +footer .pkgdown { + text-align: right; } -.navbar-default .navbar-nav > .active > a, -.navbar-default .navbar-nav > .active > a:hover, -.navbar-default .navbar-nav > .active > a:focus { - background-color: #eee; +footer p { + margin-bottom: 0; } -/* Table of contents --------------------------*/ - -#sidebar { - /* - Needed to avoid bug in sticky-kit: - https://github.com/leafo/sticky-kit/issues/169 - */ - position:static; +img.icon { + float: right; } -#sidebar h2 { - font-size: 1.6em; - margin-top: 1em; - margin-bottom: 0.25em; +img { + max-width: 100%; } -#sidebar .list-unstyled li { - margin-bottom: 0.5em; - line-height: 1.4; -} +/* Typographic tweaking ---------------------------------*/ -#sidebar small { - color: #777; +.contents h1.page-header { + margin-top: calc(-60px + 1em); } -/* Syntax highlighting ---------------------------------------------------- */ +/* Section anchors ---------------------------------*/ -pre { - word-wrap: normal; - word-break: normal; - border: none; -} +a.anchor { + margin-left: -30px; + display:inline-block; + width: 30px; + height: 30px; + visibility: hidden; -pre, code { - background-color: #fafafa; - color: #000000; - -webkit-font-smoothing: subpixel-antialiased; + background-image: url(./link.svg); + background-repeat: no-repeat; + background-size: 20px 20px; + background-position: center center; } -pre img { - background-color: #fff; - display: block; +.hasAnchor:hover a.anchor { + visibility: visible; } -code a, pre a { - color: #375f84; +@media (max-width: 767px) { + .hasAnchor:hover a.anchor { + visibility: hidden; + } } -.fl {color: #1514b5;} -.fu {color: #000000;} /* function */ -.ch,.st {color: #036a07;} /* string */ -.kw {color: #264D66;} /* keyword */ -.co {color: #777777;} /* comment */ -.message { color: black; font-weight: bolder;} -.error { color: orange; font-weight: bolder;} -.warning { color: orange; font-weight: normal;} - - -/* Status --------------------------- */ +/* Fixes for fixed navbar --------------------------*/ -.status-container { - padding-top:32px; +.contents h1, .contents h2, .contents h3, .contents h4 { + padding-top: 60px; + margin-top: -40px; } -.status-container a { - display: block; - margin-bottom: 5px; +/* Static header placement on mobile devices */ +@media (max-width: 767px) { + .navbar-fixed-top { + position: absolute; + } + .navbar { + padding: 0; + } } -/* For shrinking navbar ------------------ */ -/* For big header +/* Sidebar --------------------------*/ - &-brand { - font-family: $font-family-monospace; - font-weight: normal; - font-size: 48px; - padding: 35px 15px; +#sidebar { + margin-top: 30px; +} +#sidebar h2 { + font-size: 1.5em; + margin-top: 1em; +} - padding-left: 84px; - background-image:url(../logo.png); - background-size: 60px auto; - background-repeat: no-repeat; - background-position: 15px center; +#sidebar h2:first-child { + margin-top: 0; +} - } -*/ +#sidebar .list-unstyled li { + margin-bottom: 0.5em; +} + +.orcid { + height: 16px; + vertical-align: middle; +} /* Reference index & topics ----------------------------------------------- */ .ref-index th {font-weight: normal;} -.ref-index h2 {font-size: 20px;} .ref-index td {vertical-align: top;} .ref-index .alias {width: 40%;} @@ -151,93 +144,89 @@ code a, pre a { .ref-arguments th {text-align: right; padding-right: 10px;} .ref-arguments th, .ref-arguments td {vertical-align: top;} -.ref-arguments .name {width: 10%;} -.ref-arguments .desc {width: 90%;} +.ref-arguments .name {width: 20%;} +.ref-arguments .desc {width: 80%;} -/* For the rstudio footer ------- */ +/* Nice scrolling for wide elements --------------------------------------- */ -footer { - margin-top: 45px; - padding: 35px 0 36px; - border-top: 1px solid #e5e5e5; - - display: flex; - color: #666; -} -footer p { - margin-bottom: 0; -} -footer .tidyverse { - flex: 1; -} -footer .author { - flex: 1; - text-align: right; +table { + display: block; + overflow: auto; } -/* ---------------------- hover anchor tags */ +/* Syntax highlighting ---------------------------------------------------- */ -.hasAnchor { - margin-left: -30px; +pre { + word-wrap: normal; + word-break: normal; + border: 1px solid #eee; } -a.anchor { - display:inline-block; - width: 30px; - height: 30px; - visibility: hidden; - - background-image: url(./link.svg); - background-repeat: no-repeat; - background-size: 20px 20px; - background-position: center center; +pre, code { + background-color: #f8f8f8; + color: #333; } -.hasAnchor:hover a.anchor { - visibility: visible; +pre code { + overflow: auto; + word-wrap: normal; + white-space: pre; } -@media (max-width: 767px) { - .hasAnchor {margin-left: 0;} - a.anchor {float: right;} +pre .img { + margin: 5px 0; } -/* Tweak appearance of navigation in sidebar ---------------------- */ +pre .img img { + background-color: #fff; + display: block; + height: auto; +} -#sidebar .nav { - padding-left: 0px; - list-style-type: none; - color: #5a9ddb; +code a, pre a { + color: #375f84; } -#sidebar .nav > li { - padding: 10px 0 0px 20px; - display: list-item; - line-height: 20px; - background-image: url(./tocBullet.svg); - background-repeat: no-repeat; - background-size: 16px 280px; - background-position: left 0px; +a.sourceLine:hover { + text-decoration: none; } -#sidebar .nav > li.active { - background-position: left -240px; +.fl {color: #1514b5;} +.fu {color: #000000;} /* function */ +.ch,.st {color: #036a07;} /* string */ +.kw {color: #264D66;} /* keyword */ +.co {color: #888888;} /* comment */ + +.message { color: black; font-weight: bolder;} +.error { color: orange; font-weight: bolder;} +.warning { color: #6A0366; font-weight: bolder;} + +/* Clipboard --------------------------*/ + +.hasCopyButton { + position: relative; } -#sidebar a { - padding: 0px; - color: #5a9ddb; - background-color: transparent; +.btn-copy-ex { + position: absolute; + right: 0; + top: 0; + visibility: hidden; } -#sidebar a:hover { - background-color: transparent; - text-decoration: underline; +.hasCopyButton:hover button.btn-copy-ex { + visibility: visible; } -/* orcid ------------------------------------ */ +/* mark.js ----------------------------*/ -.orcid { - height: 16px; - vertical-align: middle; +mark { + background-color: rgba(255, 255, 51, 0.5); + border-bottom: 2px solid rgba(255, 153, 51, 0.3); + padding: 1px; +} + +/* vertical spacing after htmlwidgets */ +.html-widget { + margin-bottom: 10px; } diff --git a/docs/pkgdown.js b/docs/pkgdown.js index e6ff1a3ee..4fab7e5e4 100644 --- a/docs/pkgdown.js +++ b/docs/pkgdown.js @@ -1,49 +1,110 @@ -$(function() { - $("#sidebar").stick_in_parent({ - offset_top: $("#sidebar").offset().top - }); - $('body').scrollspy({ - target: '#sidebar' - }); +/* http://gregfranko.com/blog/jquery-best-practices/ */ +(function($) { + $(function() { + + $("#sidebar") + .stick_in_parent({offset_top: 40}) + .on('sticky_kit:bottom', function(e) { + $(this).parent().css('position', 'static'); + }) + .on('sticky_kit:unbottom', function(e) { + $(this).parent().css('position', 'relative'); + }); + + $('body').scrollspy({ + target: '#sidebar', + offset: 60 + }); + + $('[data-toggle="tooltip"]').tooltip(); - var cur_path = paths(location.pathname); - $("#navbar ul li a").each(function(index, value) { - if (value.text == "Home") - return; - if (value.getAttribute("href") === "#") - return; - - var path = paths(value.pathname); - if (is_prefix(cur_path, path)) { - // Add class to parent
  • , and enclosing
  • if in dropdown - var menu_anchor = $(value); + var cur_path = paths(location.pathname); + var links = $("#navbar ul li a"); + var max_length = -1; + var pos = -1; + for (var i = 0; i < links.length; i++) { + if (links[i].getAttribute("href") === "#") + continue; + var path = paths(links[i].pathname); + + var length = prefix_length(cur_path, path); + if (length > max_length) { + max_length = length; + pos = i; + } + } + + // Add class to parent
  • , and enclosing
  • if in dropdown + if (pos >= 0) { + var menu_anchor = $(links[pos]); menu_anchor.parent().addClass("active"); menu_anchor.closest("li.dropdown").addClass("active"); } }); -}); + function paths(pathname) { + var pieces = pathname.split("/"); + pieces.shift(); // always starts with / + + var end = pieces[pieces.length - 1]; + if (end === "index.html" || end === "") + pieces.pop(); + return(pieces); + } + function prefix_length(needle, haystack) { + if (needle.length > haystack.length) + return(0); + // Special case for length-0 haystack, since for loop won't run + if (haystack.length === 0) { + return(needle.length === 0 ? 1 : 0); + } -function paths(pathname) { - var pieces = pathname.split("/"); - pieces.shift(); // always starts with / + for (var i = 0; i < haystack.length; i++) { + if (needle[i] != haystack[i]) + return(i); + } - var end = pieces[pieces.length - 1]; - if (end === "index.html" || end === "") - pieces.pop(); - return(pieces); -} + return(haystack.length); + } -function is_prefix(needle, haystack) { - if (needle.length > haystack.lengh) - return(false); + /* Clipboard --------------------------*/ - for (var i = 0; i < haystack.length; i++) { - if (needle[i] != haystack[i]) - return(false); + function changeTooltipMessage(element, msg) { + var tooltipOriginalTitle=element.getAttribute('data-original-title'); + element.setAttribute('data-original-title', msg); + $(element).tooltip('show'); + element.setAttribute('data-original-title', tooltipOriginalTitle); } - return(true); -} + if(ClipboardJS.isSupported()) { + $(document).ready(function() { + var copyButton = ""; + + $(".examples, div.sourceCode").addClass("hasCopyButton"); + + // Insert copy buttons: + $(copyButton).prependTo(".hasCopyButton"); + + // Initialize tooltips: + $('.btn-copy-ex').tooltip({container: 'body'}); + + // Initialize clipboard: + var clipboardBtnCopies = new ClipboardJS('[data-clipboard-copy]', { + text: function(trigger) { + return trigger.parentNode.textContent; + } + }); + + clipboardBtnCopies.on('success', function(e) { + changeTooltipMessage(e.trigger, 'Copied!'); + e.clearSelection(); + }); + + clipboardBtnCopies.on('error', function() { + changeTooltipMessage(e.trigger,'Press Ctrl+C or Command+C to copy'); + }); + }); + } +})(window.jQuery || window.$) diff --git a/docs/reference/C5.0_train.html b/docs/reference/C5.0_train.html index 58fd0faba..58e6fcc4c 100644 --- a/docs/reference/C5.0_train.html +++ b/docs/reference/C5.0_train.html @@ -18,18 +18,42 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +62,8 @@
  • + @@ -171,22 +200,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/boost_tree.html b/docs/reference/boost_tree.html index 033f2fe98..154b55fef 100644 --- a/docs/reference/boost_tree.html +++ b/docs/reference/boost_tree.html @@ -18,18 +18,62 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +82,8 @@ @@ -319,22 +368,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/check_empty_ellipse.html b/docs/reference/check_empty_ellipse.html index 7ed3a701f..0c29682db 100644 --- a/docs/reference/check_empty_ellipse.html +++ b/docs/reference/check_empty_ellipse.html @@ -18,18 +18,41 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +61,8 @@ @@ -134,22 +162,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/descriptors.html b/docs/reference/descriptors.html index de411872d..0ff7f5791 100644 --- a/docs/reference/descriptors.html +++ b/docs/reference/descriptors.html @@ -18,18 +18,45 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +65,8 @@ @@ -128,10 +160,10 @@

    Details

    Existing functions:

    • .obs(): The current number of rows in the data set.

    • -
    • .cols(): The number of columns in the data set that are +

    • .preds(): The number of columns in the data set that are associated with the predictors prior to dummy variable creation.

    • -
    • .preds(): The number of predictors after dummy variables -are created (if any).

    • +
    • .cols(): The number of predictor columns availible after dummy +variables are created (if any).

    • .facts(): The number of factor predictors in the dat set.

    • .lvls(): If the outcome is a factor, this is a table with the counts for each level (and NA otherwise).

    • @@ -145,8 +177,8 @@

      Details

    For example, if you use the model formula Sepal.Width ~ . with the iris data, the values would be

    - .cols()  =   4          (the 4 columns in `iris`)
    - .preds() =   5          (3 numeric columns + 2 from Species dummy variables)
    + .preds() =   4          (the 4 columns in `iris`)
    + .cols()  =   5          (3 numeric columns + 2 from Species dummy variables)
      .obs()   = 150
      .lvls()  =  NA          (no factor outcome)
      .facts() =   1          (the Species predictor)
    @@ -155,8 +187,8 @@ 

    Details .dat() = <data.frame> (The full data set)

    If the formula Species ~ . where used:

    - .cols()  =   4          (the 4 numeric columns in `iris`)
    - .preds() =   4          (same)
    + .preds() =   4          (the 4 numeric columns in `iris`)
    + .cols()  =   4          (same)
      .obs()   = 150
      .lvls()  =  c(setosa = 50, versicolor = 50, virginica = 50)
      .facts() =   0
    @@ -189,22 +221,15 @@ 

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/fit.html b/docs/reference/fit.html index 90f05689a..3c4b908fe 100644 --- a/docs/reference/fit.html +++ b/docs/reference/fit.html @@ -18,18 +18,43 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +63,8 @@ @@ -202,9 +232,7 @@

    Examp # methods for specifying the model can be used library(dplyr)
    #> Warning: package ‘dplyr’ was built under R version 3.5.1
    #> -#> Attaching package: ‘dplyr’
    #> The following object is masked from ‘package:testthat’: -#> -#> matches
    #> The following objects are masked from ‘package:stats’: +#> Attaching package: ‘dplyr’
    #> The following objects are masked from ‘package:stats’: #> #> filter, lag
    #> The following objects are masked from ‘package:base’: #> @@ -267,22 +295,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/fit_control.html b/docs/reference/fit_control.html index a227b9baa..ce5c79587 100644 --- a/docs/reference/fit_control.html +++ b/docs/reference/fit_control.html @@ -18,18 +18,42 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +62,8 @@ @@ -148,22 +177,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/index.html b/docs/reference/index.html index 9a584cd37..14ad56384 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -18,18 +18,38 @@ - + + + + + + + - + + + + + - + + + + + @@ -38,7 +58,8 @@ @@ -276,22 +301,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/keras_mlp.html b/docs/reference/keras_mlp.html index 782ec4813..8ffef2246 100644 --- a/docs/reference/keras_mlp.html +++ b/docs/reference/keras_mlp.html @@ -18,18 +18,43 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +63,8 @@ @@ -173,22 +203,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/lending_club.html b/docs/reference/lending_club.html index 283518805..fd6acf087 100644 --- a/docs/reference/lending_club.html +++ b/docs/reference/lending_club.html @@ -18,18 +18,41 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +61,8 @@ @@ -172,22 +200,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/linear_reg.html b/docs/reference/linear_reg.html index 72abeb3a3..eb59f3ba5 100644 --- a/docs/reference/linear_reg.html +++ b/docs/reference/linear_reg.html @@ -18,18 +18,54 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +74,8 @@ @@ -281,22 +322,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/logistic_reg.html b/docs/reference/logistic_reg.html index 6a4249bd3..c5f9480a2 100644 --- a/docs/reference/logistic_reg.html +++ b/docs/reference/logistic_reg.html @@ -18,18 +18,54 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +74,8 @@ @@ -282,22 +323,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/make_classes.html b/docs/reference/make_classes.html index 342702856..208b6b381 100644 --- a/docs/reference/make_classes.html +++ b/docs/reference/make_classes.html @@ -18,18 +18,41 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +61,8 @@ @@ -134,22 +162,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/mars.html b/docs/reference/mars.html index e3bb7be62..6a8381d41 100644 --- a/docs/reference/mars.html +++ b/docs/reference/mars.html @@ -18,18 +18,57 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +77,8 @@ @@ -245,22 +289,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/mlp.html b/docs/reference/mlp.html index f9a6c5f7a..db5e70054 100644 --- a/docs/reference/mlp.html +++ b/docs/reference/mlp.html @@ -18,18 +18,57 @@ - + + + + + + + - + + + + + + + + + + - + + + + + @@ -38,7 +77,8 @@ @@ -282,22 +326,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/model_fit.html b/docs/reference/model_fit.html index 78e0004ea..89ce9faa3 100644 --- a/docs/reference/model_fit.html +++ b/docs/reference/model_fit.html @@ -18,18 +18,42 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +62,8 @@ @@ -121,39 +150,64 @@

    Details object would contain items such as the terms object and so on. When no information is required, this is NA.

    -

    This class and structure is the basis for how parsnip +

    As discussed in the documentation for model_spec, the +original arguments to the specification are saved as quosures. +These are evaluated for the model_fit object prior to fitting. +If the resulting model object prints its call, any user-defined +options are shown in the call preceded by a tilde (see the +example below). This is a result of the use of quosures in the +specification.

    +

    This class and structure is the basis for how parsnip stores model objects after to seeing the data and applying a model.

    +

    Examples

    +
    +spec_obj <- linear_reg(x = ifelse(.obs() < 500, TRUE, FALSE)) +spec_obj
    #> Linear Regression Model Specification (regression) +#> +#> Engine-Specific Arguments: +#> x = ifelse(.obs() < 500, TRUE, FALSE) +#>
    +fit_obj <- fit(spec_obj, mpg ~ ., data = mtcars, engine = "lm") +fit_obj
    #> parsnip model object +#> +#> +#> Call: +#> stats::lm(formula = formula, data = data, x = ~ifelse(.obs() < +#> 500, TRUE, FALSE)) +#> +#> Coefficients: +#> (Intercept) cyl disp hp drat wt +#> 12.30337 -0.11144 0.01334 -0.02148 0.78711 -3.71530 +#> qsec vs am gear carb +#> 0.82104 0.31776 2.52023 0.65541 -0.19942 +#>
    +nrow(fit_obj$fit$x)
    #> [1] 32
    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/model_printer.html b/docs/reference/model_printer.html index 6dbc36cfd..a9d026394 100644 --- a/docs/reference/model_printer.html +++ b/docs/reference/model_printer.html @@ -18,18 +18,42 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +62,8 @@ @@ -133,22 +162,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/model_spec.html b/docs/reference/model_spec.html index 347704c29..7ac8b7001 100644 --- a/docs/reference/model_spec.html +++ b/docs/reference/model_spec.html @@ -18,18 +18,42 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +62,8 @@ @@ -113,14 +142,15 @@

    Details names of these arguments may be different form their counterparts n the underlying model function. For example, for a glmnet model, the argument name for the amount of the penalty -is called "penalty" instead of "lambda" to make it more -general and usable across different types of models (and to not -be specific to a particular model function). The elements of -args can be quoted expressions or varying(). If left to -their defaults (NULL), the arguments will use the underlying -model functions default value.

    -
  • other: An optional vector of model-function-specific -parameters. As with args, these can also be quoted or +is called "penalty" instead of "lambda" to make it more general +and usable across different types of models (and to not be +specific to a particular model function). The elements of args +can varying(). If left to their defaults (NULL), the +arguments will use the underlying model functions default value. +As discussed below, the arguments in args are captured as +quosures and are not immediately executed.

  • +
  • ...: Optional model-function-specific +parameters. As with args, these will be quosures and can be varying().

  • mode: The type of model, such as "regression" or "classification". Other modes will be added once the package @@ -136,6 +166,80 @@

    Details

    This class and structure is the basis for how parsnip stores model objects prior to seeing the data.

    +

    Argument Details

    + + +

    An important detail to understand when creating model +specifications is that they are intended to be functionally +independent of the data. While it is true that some tuning +parameters are data dependent, the model specification does +not interact with the data at all.

    +

    For example, most R functions immediately evaluate their +arguments. For example, when calling mean(dat_vec), the object +dat_vec is immediately evaluated inside of the function.

    +

    parsnip model functions do not do this. For example, using

    +
    + rand_forest(mtry = ncol(iris) - 1)
    +
    +

    does not execute ncol(iris) - 1 when creating the specification. +This can be seen in the output:

    +
    + > rand_forest(mtry = ncol(iris) - 1)
    + Random Forest Model Specification (unknown)
    +    Main Arguments:
    +   mtry = ncol(iris) - 1
    +
    +

    The model functions save the argument expressions and their +associated environments (a.k.a. a quosure) to be evaluated later +when either fit() or fit_xy() are called with the actual +data.

    +

    The consequence of this strategy is that any data required to +get the parameter values must be available when the model is +fit. The two main ways that this can fail is if:

    +
      +
    1. The data have been modified between the creation of the +model specification and when the model fit function is invoked.

    2. +
    3. If the model specification is saved and loaded into a new +session where those same data objects do not exist.

    4. +
    +

    The best way to avoid these issues is to not reference any data +objects in the global environment but to use data descriptors +such as .cols(). Another way of writing the previous +specification is

    +
    + rand_forest(mtry = .cols() - 1)
    +
    +

    This is not dependent on any specific data object and +is evaluated immediately before the model fitting process begins.

    +

    One less advantageous approach to solving this issue is to use +quasiquotation. This would insert the actual R object into the +model specification and might be the best idea when the data +object is small. For example, using

    +
    + rand_forest(mtry = ncol(!!iris) - 1)
    +
    +

    would work (and be reproducible between sessions) but embeds +the entire iris data set into the mtry expression:

    +
    + > rand_forest(mtry = ncol(!!iris) - 1)
    + Random Forest Model Specification (unknown)
    +    Main Arguments:
    +   mtry = ncol(structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, <snip>
    +
    +

    However, if there were an object with the number of columns in +it, this wouldn't be too bad:

    +
    + > mtry_val <- ncol(iris) - 1
    + > mtry_val
    + [1] 4
    + > rand_forest(mtry = !!mtry_val)
    + Random Forest Model Specification (unknown)
    +    Main Arguments:
    +   mtry = 4
    +
    +

    More information on quosures and quasiquotation can be found at +https://tidyeval.tidyverse.org.

    + @@ -150,22 +256,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/multi_predict.html b/docs/reference/multi_predict.html index 8ee60d350..0a14472ef 100644 --- a/docs/reference/multi_predict.html +++ b/docs/reference/multi_predict.html @@ -18,18 +18,41 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +61,8 @@
  • + @@ -144,22 +172,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/multinom_reg.html b/docs/reference/multinom_reg.html index 51245bc9d..5a768b726 100644 --- a/docs/reference/multinom_reg.html +++ b/docs/reference/multinom_reg.html @@ -18,18 +18,54 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +74,8 @@ @@ -264,22 +305,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/nearest_neighbor.html b/docs/reference/nearest_neighbor.html index 0f7ffb37b..9b2ff329b 100644 --- a/docs/reference/nearest_neighbor.html +++ b/docs/reference/nearest_neighbor.html @@ -18,18 +18,57 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +77,8 @@ @@ -218,22 +262,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/other_predict.html b/docs/reference/other_predict.html index 8ad154b48..34f52b311 100644 --- a/docs/reference/other_predict.html +++ b/docs/reference/other_predict.html @@ -18,18 +18,41 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +61,8 @@ @@ -173,22 +201,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/predict.model_fit.html b/docs/reference/predict.model_fit.html index 24e7cd00a..7fa9fd672 100644 --- a/docs/reference/predict.model_fit.html +++ b/docs/reference/predict.model_fit.html @@ -18,18 +18,43 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +63,8 @@ @@ -273,22 +303,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/rand_forest.html b/docs/reference/rand_forest.html index 6028f32a6..db837057e 100644 --- a/docs/reference/rand_forest.html +++ b/docs/reference/rand_forest.html @@ -18,18 +18,55 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +75,8 @@ @@ -289,22 +331,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/reexports.html b/docs/reference/reexports.html index 1283ffa79..43945fa4e 100644 --- a/docs/reference/reexports.html +++ b/docs/reference/reexports.html @@ -18,18 +18,47 @@ - + + + + + + + - + + + + + + + + + + - + + + + + @@ -38,7 +67,8 @@ @@ -123,22 +157,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/set_args.html b/docs/reference/set_args.html index 3ded6fcb5..164104ab0 100644 --- a/docs/reference/set_args.html +++ b/docs/reference/set_args.html @@ -18,18 +18,42 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +62,8 @@ @@ -168,22 +197,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/show_call.html b/docs/reference/show_call.html index 51f15d4c7..3cfbb74be 100644 --- a/docs/reference/show_call.html +++ b/docs/reference/show_call.html @@ -18,18 +18,41 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +61,8 @@ @@ -134,22 +162,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/surv_reg.html b/docs/reference/surv_reg.html index d5440bf86..58a8a53e1 100644 --- a/docs/reference/surv_reg.html +++ b/docs/reference/surv_reg.html @@ -18,18 +18,52 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +72,8 @@ @@ -216,22 +255,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/translate.html b/docs/reference/translate.html index 7c9c5dbe2..ddc595b79 100644 --- a/docs/reference/translate.html +++ b/docs/reference/translate.html @@ -18,18 +18,43 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +63,8 @@ @@ -198,22 +228,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/type_sum.model_spec.html b/docs/reference/type_sum.model_spec.html index a285603be..366434d51 100644 --- a/docs/reference/type_sum.model_spec.html +++ b/docs/reference/type_sum.model_spec.html @@ -18,18 +18,42 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +62,8 @@ @@ -150,22 +179,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/varying.html b/docs/reference/varying.html index 46399378e..d61e25571 100644 --- a/docs/reference/varying.html +++ b/docs/reference/varying.html @@ -18,18 +18,41 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +61,8 @@ @@ -118,22 +146,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/varying_args.html b/docs/reference/varying_args.html index 0778dbc41..7e8876067 100644 --- a/docs/reference/varying_args.html +++ b/docs/reference/varying_args.html @@ -18,18 +18,42 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +62,8 @@ @@ -142,10 +171,8 @@

    Value

    Examples

    library(dplyr) -library(rlang)
    #> -#> Attaching package: ‘rlang’
    #> The following objects are masked from ‘package:testthat’: -#> -#> is_false, is_null, is_true
    +library(rlang) + rand_forest() %>% varying_args(id = "plain")
    #> Warning: `list_len()` is soft-deprecated as of rlang 0.2.0. #> Please use `new_list()` instead #> This warning is displayed once per session.
    #> # A tibble: 3 x 4 @@ -206,22 +233,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/wa_churn.html b/docs/reference/wa_churn.html index 1dd08f0a8..db36f222d 100644 --- a/docs/reference/wa_churn.html +++ b/docs/reference/wa_churn.html @@ -18,18 +18,41 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +61,8 @@ @@ -169,22 +197,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/reference/xgb_train.html b/docs/reference/xgb_train.html index bfa20afda..d7cd704c3 100644 --- a/docs/reference/xgb_train.html +++ b/docs/reference/xgb_train.html @@ -18,18 +18,42 @@ - + + + + + + + - + + + + + + + + - + + + + + @@ -38,7 +62,8 @@ @@ -175,22 +204,15 @@

    Contents

    -

    parsnip is a part of the tidyverse, an ecosystem of packages designed with common APIs and a shared philosophy. Learn more at tidyverse.org.

    +

    probably is a part of the tidymodels ecosystem, a collection of modeling packages designed with common APIs and a shared philosophy.

    -

    Developed by Max Kuhn.

    -

    Site built by pkgdown.

    +

    + Developed by Max Kuhn. + Site built by pkgdown. +

    - - -
    diff --git a/docs/tidyverse-2.css b/docs/tidyverse-2.css new file mode 100644 index 000000000..6bd033017 --- /dev/null +++ b/docs/tidyverse-2.css @@ -0,0 +1,117 @@ +body {font-size: 16px;} +h1 {font-size: 40px;} +h2 {font-size: 30px;} + +/* navbar ----------------------------------------------- */ + +.navbar .info { + float: left; + height: 50px; + width: 140px; + font-size: 80%; + position: relative; + margin-left: 5px; +} +.navbar .info .partof { + position: absolute; + top: 0; +} +.navbar .info .version { + position: absolute; + bottom: 0; +} +.navbar .info .version-danger { + font-weight: bold; + color: orange; +} + +.navbar-form { + margin-top: 3px; + margin-bottom: 0; +} + +.navbar-toggle { + margin-top: 8px; + margin-bottom: 5px; +} + +.navbar-nav li a { + padding-bottom: 10px; +} +.navbar-default .navbar-nav > .active > a, +.navbar-default .navbar-nav > .active > a:hover, +.navbar-default .navbar-nav > .active > a:focus { + background-color: #eee; + border-radius: 3px; +} + +/* footer ------------------------------------------------ */ + +footer { + margin-top: 45px; + padding: 35px 0 36px; + border-top: 1px solid #e5e5e5; + + display: flex; + color: #666; +} +footer p { + margin-bottom: 0; +} +footer .tidyverse { + flex: 1; + margin-right: 1em; +} +footer .author { + flex: 1; + text-align: right; + margin-left: 1em; +} + +/* sidebar ------------------------------------------------ */ + +#sidebar h2 { + font-size: 1.6em; + margin-top: 1em; + margin-bottom: 0.25em; +} + +#sidebar .list-unstyled li { + margin-bottom: 0.5em; + line-height: 1.4; +} + +#sidebar small { + color: #777; +} + +#sidebar .nav { + padding-left: 0px; + list-style-type: none; + color: #5a9ddb; +} + +#sidebar .nav > li { + padding: 10px 0 0px 20px; + display: list-item; + line-height: 20px; + background-image: url(./tocBullet.svg); + background-repeat: no-repeat; + background-size: 16px 280px; + background-position: left 0px; +} + +#sidebar .nav > li.active { + background-position: left -240px; +} + +#sidebar a { + padding: 0px; + color: #5a9ddb; + background-color: transparent; +} + +#sidebar a:hover { + background-color: transparent; + text-decoration: underline; +} diff --git a/docs/tidyverse.css b/docs/tidyverse.css index 1e691967a..ae6337c5f 100644 --- a/docs/tidyverse.css +++ b/docs/tidyverse.css @@ -192,69 +192,56 @@ th { color: #000 !important; box-shadow: none !important; text-shadow: none !important; } - a, a:visited { text-decoration: underline; } - a[href]:after { content: " (" attr(href) ")"; } - abbr[title]:after { content: " (" attr(title) ")"; } - a[href^="#"]:after, a[href^="javascript:"]:after { content: ""; } - pre, blockquote { border: 1px solid #999; page-break-inside: avoid; } - thead { display: table-header-group; } - tr, img { page-break-inside: avoid; } - img { max-width: 100% !important; } - p, h2, h3 { orphans: 3; widows: 3; } - h2, h3 { page-break-after: avoid; } - .navbar { display: none; } - .btn > .caret, .dropup > .btn > .caret { border-top-color: #000 !important; } - .label { border: 1px solid #000; } - .table { border-collapse: collapse !important; } .table td, .table th { background-color: #fff !important; } - .table-bordered th, .table-bordered td { border: 1px solid #ddd !important; } } + @font-face { font-family: 'Glyphicons Halflings'; src: url("../fonts/bootstrap/glyphicons-halflings-regular.eot"); src: url("../fonts/bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"), url("../fonts/bootstrap/glyphicons-halflings-regular.woff2") format("woff2"), url("../fonts/bootstrap/glyphicons-halflings-regular.woff") format("woff"), url("../fonts/bootstrap/glyphicons-halflings-regular.ttf") format("truetype"), url("../fonts/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg"); } + .glyphicon { position: relative; top: 1px; @@ -1066,7 +1053,7 @@ th { html { font-size: 10px; - -webkit-tap-highlight-color: transparent; } + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } body { font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; @@ -1390,8 +1377,10 @@ dd { .dl-horizontal dd:before, .dl-horizontal dd:after { content: " "; display: table; } + .dl-horizontal dd:after { clear: both; } + @media (min-width: 768px) { .dl-horizontal dt { float: left; @@ -1715,471 +1704,321 @@ pre { @media (min-width: 768px) { .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 { float: left; } - .col-sm-1 { width: 8.33333%; } - .col-sm-2 { width: 16.66667%; } - .col-sm-3 { width: 25%; } - .col-sm-4 { width: 33.33333%; } - .col-sm-5 { width: 41.66667%; } - .col-sm-6 { width: 50%; } - .col-sm-7 { width: 58.33333%; } - .col-sm-8 { width: 66.66667%; } - .col-sm-9 { width: 75%; } - .col-sm-10 { width: 83.33333%; } - .col-sm-11 { width: 91.66667%; } - .col-sm-12 { width: 100%; } - .col-sm-pull-0 { right: auto; } - .col-sm-pull-1 { right: 8.33333%; } - .col-sm-pull-2 { right: 16.66667%; } - .col-sm-pull-3 { right: 25%; } - .col-sm-pull-4 { right: 33.33333%; } - .col-sm-pull-5 { right: 41.66667%; } - .col-sm-pull-6 { right: 50%; } - .col-sm-pull-7 { right: 58.33333%; } - .col-sm-pull-8 { right: 66.66667%; } - .col-sm-pull-9 { right: 75%; } - .col-sm-pull-10 { right: 83.33333%; } - .col-sm-pull-11 { right: 91.66667%; } - .col-sm-pull-12 { right: 100%; } - .col-sm-push-0 { left: auto; } - .col-sm-push-1 { left: 8.33333%; } - .col-sm-push-2 { left: 16.66667%; } - .col-sm-push-3 { left: 25%; } - .col-sm-push-4 { left: 33.33333%; } - .col-sm-push-5 { left: 41.66667%; } - .col-sm-push-6 { left: 50%; } - .col-sm-push-7 { left: 58.33333%; } - .col-sm-push-8 { left: 66.66667%; } - .col-sm-push-9 { left: 75%; } - .col-sm-push-10 { left: 83.33333%; } - .col-sm-push-11 { left: 91.66667%; } - .col-sm-push-12 { left: 100%; } - .col-sm-offset-0 { margin-left: 0%; } - .col-sm-offset-1 { margin-left: 8.33333%; } - .col-sm-offset-2 { margin-left: 16.66667%; } - .col-sm-offset-3 { margin-left: 25%; } - .col-sm-offset-4 { margin-left: 33.33333%; } - .col-sm-offset-5 { margin-left: 41.66667%; } - .col-sm-offset-6 { margin-left: 50%; } - .col-sm-offset-7 { margin-left: 58.33333%; } - .col-sm-offset-8 { margin-left: 66.66667%; } - .col-sm-offset-9 { margin-left: 75%; } - .col-sm-offset-10 { margin-left: 83.33333%; } - .col-sm-offset-11 { margin-left: 91.66667%; } - .col-sm-offset-12 { margin-left: 100%; } } + @media (min-width: 992px) { .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 { float: left; } - .col-md-1 { width: 8.33333%; } - .col-md-2 { width: 16.66667%; } - .col-md-3 { width: 25%; } - .col-md-4 { width: 33.33333%; } - .col-md-5 { width: 41.66667%; } - .col-md-6 { width: 50%; } - .col-md-7 { width: 58.33333%; } - .col-md-8 { width: 66.66667%; } - .col-md-9 { width: 75%; } - .col-md-10 { width: 83.33333%; } - .col-md-11 { width: 91.66667%; } - .col-md-12 { width: 100%; } - .col-md-pull-0 { right: auto; } - .col-md-pull-1 { right: 8.33333%; } - .col-md-pull-2 { right: 16.66667%; } - .col-md-pull-3 { right: 25%; } - .col-md-pull-4 { right: 33.33333%; } - .col-md-pull-5 { right: 41.66667%; } - .col-md-pull-6 { right: 50%; } - .col-md-pull-7 { right: 58.33333%; } - .col-md-pull-8 { right: 66.66667%; } - .col-md-pull-9 { right: 75%; } - .col-md-pull-10 { right: 83.33333%; } - .col-md-pull-11 { right: 91.66667%; } - .col-md-pull-12 { right: 100%; } - .col-md-push-0 { left: auto; } - .col-md-push-1 { left: 8.33333%; } - .col-md-push-2 { left: 16.66667%; } - .col-md-push-3 { left: 25%; } - .col-md-push-4 { left: 33.33333%; } - .col-md-push-5 { left: 41.66667%; } - .col-md-push-6 { left: 50%; } - .col-md-push-7 { left: 58.33333%; } - .col-md-push-8 { left: 66.66667%; } - .col-md-push-9 { left: 75%; } - .col-md-push-10 { left: 83.33333%; } - .col-md-push-11 { left: 91.66667%; } - .col-md-push-12 { left: 100%; } - .col-md-offset-0 { margin-left: 0%; } - .col-md-offset-1 { margin-left: 8.33333%; } - .col-md-offset-2 { margin-left: 16.66667%; } - .col-md-offset-3 { margin-left: 25%; } - .col-md-offset-4 { margin-left: 33.33333%; } - .col-md-offset-5 { margin-left: 41.66667%; } - .col-md-offset-6 { margin-left: 50%; } - .col-md-offset-7 { margin-left: 58.33333%; } - .col-md-offset-8 { margin-left: 66.66667%; } - .col-md-offset-9 { margin-left: 75%; } - .col-md-offset-10 { margin-left: 83.33333%; } - .col-md-offset-11 { margin-left: 91.66667%; } - .col-md-offset-12 { margin-left: 100%; } } + @media (min-width: 1200px) { .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12 { float: left; } - .col-lg-1 { width: 8.33333%; } - .col-lg-2 { width: 16.66667%; } - .col-lg-3 { width: 25%; } - .col-lg-4 { width: 33.33333%; } - .col-lg-5 { width: 41.66667%; } - .col-lg-6 { width: 50%; } - .col-lg-7 { width: 58.33333%; } - .col-lg-8 { width: 66.66667%; } - .col-lg-9 { width: 75%; } - .col-lg-10 { width: 83.33333%; } - .col-lg-11 { width: 91.66667%; } - .col-lg-12 { width: 100%; } - .col-lg-pull-0 { right: auto; } - .col-lg-pull-1 { right: 8.33333%; } - .col-lg-pull-2 { right: 16.66667%; } - .col-lg-pull-3 { right: 25%; } - .col-lg-pull-4 { right: 33.33333%; } - .col-lg-pull-5 { right: 41.66667%; } - .col-lg-pull-6 { right: 50%; } - .col-lg-pull-7 { right: 58.33333%; } - .col-lg-pull-8 { right: 66.66667%; } - .col-lg-pull-9 { right: 75%; } - .col-lg-pull-10 { right: 83.33333%; } - .col-lg-pull-11 { right: 91.66667%; } - .col-lg-pull-12 { right: 100%; } - .col-lg-push-0 { left: auto; } - .col-lg-push-1 { left: 8.33333%; } - .col-lg-push-2 { left: 16.66667%; } - .col-lg-push-3 { left: 25%; } - .col-lg-push-4 { left: 33.33333%; } - .col-lg-push-5 { left: 41.66667%; } - .col-lg-push-6 { left: 50%; } - .col-lg-push-7 { left: 58.33333%; } - .col-lg-push-8 { left: 66.66667%; } - .col-lg-push-9 { left: 75%; } - .col-lg-push-10 { left: 83.33333%; } - .col-lg-push-11 { left: 91.66667%; } - .col-lg-push-12 { left: 100%; } - .col-lg-offset-0 { margin-left: 0%; } - .col-lg-offset-1 { margin-left: 8.33333%; } - .col-lg-offset-2 { margin-left: 16.66667%; } - .col-lg-offset-3 { margin-left: 25%; } - .col-lg-offset-4 { margin-left: 33.33333%; } - .col-lg-offset-5 { margin-left: 41.66667%; } - .col-lg-offset-6 { margin-left: 50%; } - .col-lg-offset-7 { margin-left: 58.33333%; } - .col-lg-offset-8 { margin-left: 66.66667%; } - .col-lg-offset-9 { margin-left: 75%; } - .col-lg-offset-10 { margin-left: 83.33333%; } - .col-lg-offset-11 { margin-left: 91.66667%; } - .col-lg-offset-12 { margin-left: 100%; } } + table { background-color: transparent; } @@ -2260,7 +2099,9 @@ table th[class*="col-"] { display: table-cell; } .table > thead > tr > td.active, -.table > thead > tr > th.active, .table > thead > tr.active > td, .table > thead > tr.active > th, +.table > thead > tr > th.active, +.table > thead > tr.active > td, +.table > thead > tr.active > th, .table > tbody > tr > td.active, .table > tbody > tr > th.active, .table > tbody > tr.active > td, @@ -2272,11 +2113,16 @@ table th[class*="col-"] { background-color: #f5f5f5; } .table-hover > tbody > tr > td.active:hover, -.table-hover > tbody > tr > th.active:hover, .table-hover > tbody > tr.active:hover > td, .table-hover > tbody > tr:hover > .active, .table-hover > tbody > tr.active:hover > th { +.table-hover > tbody > tr > th.active:hover, +.table-hover > tbody > tr.active:hover > td, +.table-hover > tbody > tr:hover > .active, +.table-hover > tbody > tr.active:hover > th { background-color: #e8e8e8; } .table > thead > tr > td.success, -.table > thead > tr > th.success, .table > thead > tr.success > td, .table > thead > tr.success > th, +.table > thead > tr > th.success, +.table > thead > tr.success > td, +.table > thead > tr.success > th, .table > tbody > tr > td.success, .table > tbody > tr > th.success, .table > tbody > tr.success > td, @@ -2288,11 +2134,16 @@ table th[class*="col-"] { background-color: #dff0d8; } .table-hover > tbody > tr > td.success:hover, -.table-hover > tbody > tr > th.success:hover, .table-hover > tbody > tr.success:hover > td, .table-hover > tbody > tr:hover > .success, .table-hover > tbody > tr.success:hover > th { +.table-hover > tbody > tr > th.success:hover, +.table-hover > tbody > tr.success:hover > td, +.table-hover > tbody > tr:hover > .success, +.table-hover > tbody > tr.success:hover > th { background-color: #d0e9c6; } .table > thead > tr > td.info, -.table > thead > tr > th.info, .table > thead > tr.info > td, .table > thead > tr.info > th, +.table > thead > tr > th.info, +.table > thead > tr.info > td, +.table > thead > tr.info > th, .table > tbody > tr > td.info, .table > tbody > tr > th.info, .table > tbody > tr.info > td, @@ -2304,11 +2155,16 @@ table th[class*="col-"] { background-color: #e1bee7; } .table-hover > tbody > tr > td.info:hover, -.table-hover > tbody > tr > th.info:hover, .table-hover > tbody > tr.info:hover > td, .table-hover > tbody > tr:hover > .info, .table-hover > tbody > tr.info:hover > th { +.table-hover > tbody > tr > th.info:hover, +.table-hover > tbody > tr.info:hover > td, +.table-hover > tbody > tr:hover > .info, +.table-hover > tbody > tr.info:hover > th { background-color: #d8abe0; } .table > thead > tr > td.warning, -.table > thead > tr > th.warning, .table > thead > tr.warning > td, .table > thead > tr.warning > th, +.table > thead > tr > th.warning, +.table > thead > tr.warning > td, +.table > thead > tr.warning > th, .table > tbody > tr > td.warning, .table > tbody > tr > th.warning, .table > tbody > tr.warning > td, @@ -2320,11 +2176,16 @@ table th[class*="col-"] { background-color: #ffe0b2; } .table-hover > tbody > tr > td.warning:hover, -.table-hover > tbody > tr > th.warning:hover, .table-hover > tbody > tr.warning:hover > td, .table-hover > tbody > tr:hover > .warning, .table-hover > tbody > tr.warning:hover > th { +.table-hover > tbody > tr > th.warning:hover, +.table-hover > tbody > tr.warning:hover > td, +.table-hover > tbody > tr:hover > .warning, +.table-hover > tbody > tr.warning:hover > th { background-color: #ffd699; } .table > thead > tr > td.danger, -.table > thead > tr > th.danger, .table > thead > tr.danger > td, .table > thead > tr.danger > th, +.table > thead > tr > th.danger, +.table > thead > tr.danger > td, +.table > thead > tr.danger > th, .table > tbody > tr > td.danger, .table > tbody > tr > th.danger, .table > tbody > tr.danger > td, @@ -2336,7 +2197,10 @@ table th[class*="col-"] { background-color: #f9bdbb; } .table-hover > tbody > tr > td.danger:hover, -.table-hover > tbody > tr > th.danger:hover, .table-hover > tbody > tr.danger:hover > td, .table-hover > tbody > tr:hover > .danger, .table-hover > tbody > tr.danger:hover > th { +.table-hover > tbody > tr > th.danger:hover, +.table-hover > tbody > tr.danger:hover > td, +.table-hover > tbody > tr:hover > .danger, +.table-hover > tbody > tr.danger:hover > th { background-color: #f7a6a4; } .table-responsive { @@ -2470,10 +2334,12 @@ output { .form-control::-ms-expand { border: 0; background-color: transparent; } - .form-control[disabled], .form-control[readonly], fieldset[disabled] .form-control { + .form-control[disabled], .form-control[readonly], + fieldset[disabled] .form-control { background-color: transparent; opacity: 1; } - .form-control[disabled], fieldset[disabled] .form-control { + .form-control[disabled], + fieldset[disabled] .form-control { cursor: not-allowed; } textarea.form-control { @@ -2488,44 +2354,53 @@ input[type="search"] { input[type="datetime-local"].form-control, input[type="month"].form-control { line-height: 41px; } - input[type="date"].input-sm, .input-group-sm > input[type="date"].form-control, - .input-group-sm > input[type="date"].input-group-addon, - .input-group-sm > .input-group-btn > input[type="date"].btn, .input-group-sm input[type="date"], + input[type="date"].input-sm, .input-group-sm > input.form-control[type="date"], + .input-group-sm > input.input-group-addon[type="date"], + .input-group-sm > .input-group-btn > input.btn[type="date"], + .input-group-sm input[type="date"], input[type="time"].input-sm, - .input-group-sm > input[type="time"].form-control, - .input-group-sm > input[type="time"].input-group-addon, - .input-group-sm > .input-group-btn > input[type="time"].btn, .input-group-sm + .input-group-sm > input.form-control[type="time"], + .input-group-sm > input.input-group-addon[type="time"], + .input-group-sm > .input-group-btn > input.btn[type="time"], + .input-group-sm input[type="time"], input[type="datetime-local"].input-sm, - .input-group-sm > input[type="datetime-local"].form-control, - .input-group-sm > input[type="datetime-local"].input-group-addon, - .input-group-sm > .input-group-btn > input[type="datetime-local"].btn, .input-group-sm + .input-group-sm > input.form-control[type="datetime-local"], + .input-group-sm > input.input-group-addon[type="datetime-local"], + .input-group-sm > .input-group-btn > input.btn[type="datetime-local"], + .input-group-sm input[type="datetime-local"], input[type="month"].input-sm, - .input-group-sm > input[type="month"].form-control, - .input-group-sm > input[type="month"].input-group-addon, - .input-group-sm > .input-group-btn > input[type="month"].btn, .input-group-sm + .input-group-sm > input.form-control[type="month"], + .input-group-sm > input.input-group-addon[type="month"], + .input-group-sm > .input-group-btn > input.btn[type="month"], + .input-group-sm input[type="month"] { line-height: 31px; } - input[type="date"].input-lg, .input-group-lg > input[type="date"].form-control, - .input-group-lg > input[type="date"].input-group-addon, - .input-group-lg > .input-group-btn > input[type="date"].btn, .input-group-lg input[type="date"], + input[type="date"].input-lg, .input-group-lg > input.form-control[type="date"], + .input-group-lg > input.input-group-addon[type="date"], + .input-group-lg > .input-group-btn > input.btn[type="date"], + .input-group-lg input[type="date"], input[type="time"].input-lg, - .input-group-lg > input[type="time"].form-control, - .input-group-lg > input[type="time"].input-group-addon, - .input-group-lg > .input-group-btn > input[type="time"].btn, .input-group-lg + .input-group-lg > input.form-control[type="time"], + .input-group-lg > input.input-group-addon[type="time"], + .input-group-lg > .input-group-btn > input.btn[type="time"], + .input-group-lg input[type="time"], input[type="datetime-local"].input-lg, - .input-group-lg > input[type="datetime-local"].form-control, - .input-group-lg > input[type="datetime-local"].input-group-addon, - .input-group-lg > .input-group-btn > input[type="datetime-local"].btn, .input-group-lg + .input-group-lg > input.form-control[type="datetime-local"], + .input-group-lg > input.input-group-addon[type="datetime-local"], + .input-group-lg > .input-group-btn > input.btn[type="datetime-local"], + .input-group-lg input[type="datetime-local"], input[type="month"].input-lg, - .input-group-lg > input[type="month"].form-control, - .input-group-lg > input[type="month"].input-group-addon, - .input-group-lg > .input-group-btn > input[type="month"].btn, .input-group-lg + .input-group-lg > input.form-control[type="month"], + .input-group-lg > input.input-group-addon[type="month"], + .input-group-lg > .input-group-btn > input.btn[type="month"], + .input-group-lg input[type="month"] { line-height: 48px; } } + .form-group { margin-bottom: 15px; } @@ -2570,19 +2445,25 @@ input[type="search"] { margin-top: 0; margin-left: 10px; } -input[type="radio"][disabled], input[type="radio"].disabled, fieldset[disabled] input[type="radio"], +input[type="radio"][disabled], input[type="radio"].disabled, +fieldset[disabled] input[type="radio"], input[type="checkbox"][disabled], -input[type="checkbox"].disabled, fieldset[disabled] +input[type="checkbox"].disabled, +fieldset[disabled] input[type="checkbox"] { cursor: not-allowed; } -.radio-inline.disabled, fieldset[disabled] .radio-inline, -.checkbox-inline.disabled, fieldset[disabled] +.radio-inline.disabled, +fieldset[disabled] .radio-inline, +.checkbox-inline.disabled, +fieldset[disabled] .checkbox-inline { cursor: not-allowed; } -.radio.disabled label, fieldset[disabled] .radio label, -.checkbox.disabled label, fieldset[disabled] +.radio.disabled label, +fieldset[disabled] .radio label, +.checkbox.disabled label, +fieldset[disabled] .checkbox label { cursor: not-allowed; } @@ -2618,9 +2499,9 @@ textarea.input-sm, .input-group-sm > textarea.form-control, .input-group-sm > textarea.input-group-addon, .input-group-sm > .input-group-btn > textarea.btn, select[multiple].input-sm, -.input-group-sm > select[multiple].form-control, -.input-group-sm > select[multiple].input-group-addon, -.input-group-sm > .input-group-btn > select[multiple].btn { +.input-group-sm > select.form-control[multiple], +.input-group-sm > select.input-group-addon[multiple], +.input-group-sm > .input-group-btn > select.btn[multiple] { height: auto; } .form-group-sm .form-control { @@ -2629,12 +2510,15 @@ select[multiple].input-sm, font-size: 13px; line-height: 1.5; border-radius: 3px; } + .form-group-sm select.form-control { height: 31px; line-height: 31px; } + .form-group-sm textarea.form-control, .form-group-sm select[multiple].form-control { height: auto; } + .form-group-sm .form-control-static { height: 31px; min-height: 40px; @@ -2661,9 +2545,9 @@ textarea.input-lg, .input-group-lg > textarea.form-control, .input-group-lg > textarea.input-group-addon, .input-group-lg > .input-group-btn > textarea.btn, select[multiple].input-lg, -.input-group-lg > select[multiple].form-control, -.input-group-lg > select[multiple].input-group-addon, -.input-group-lg > .input-group-btn > select[multiple].btn { +.input-group-lg > select.form-control[multiple], +.input-group-lg > select.input-group-addon[multiple], +.input-group-lg > .input-group-btn > select.btn[multiple] { height: auto; } .form-group-lg .form-control { @@ -2672,12 +2556,15 @@ select[multiple].input-lg, font-size: 19px; line-height: 1.33333; border-radius: 3px; } + .form-group-lg select.form-control { height: 48px; line-height: 48px; } + .form-group-lg textarea.form-control, .form-group-lg select[multiple].form-control { height: auto; } + .form-group-lg .form-control-static { height: 48px; min-height: 46px; @@ -2702,18 +2589,14 @@ select[multiple].input-lg, text-align: center; pointer-events: none; } -.input-lg + .form-control-feedback, .input-group-lg > .form-control + .form-control-feedback, -.input-group-lg > .input-group-addon + .form-control-feedback, -.input-group-lg > .input-group-btn > .btn + .form-control-feedback, +.input-lg + .form-control-feedback, .input-group-lg > .form-control + .form-control-feedback, .input-group-lg > .input-group-addon + .form-control-feedback, .input-group-lg > .input-group-btn > .btn + .form-control-feedback, .input-group-lg + .form-control-feedback, .form-group-lg .form-control + .form-control-feedback { width: 48px; height: 48px; line-height: 48px; } -.input-sm + .form-control-feedback, .input-group-sm > .form-control + .form-control-feedback, -.input-group-sm > .input-group-addon + .form-control-feedback, -.input-group-sm > .input-group-btn > .btn + .form-control-feedback, +.input-sm + .form-control-feedback, .input-group-sm > .form-control + .form-control-feedback, .input-group-sm > .input-group-addon + .form-control-feedback, .input-group-sm > .input-group-btn > .btn + .form-control-feedback, .input-group-sm + .form-control-feedback, .form-group-sm .form-control + .form-control-feedback { width: 31px; @@ -2725,8 +2608,13 @@ select[multiple].input-lg, .has-success .radio, .has-success .checkbox, .has-success .radio-inline, -.has-success .checkbox-inline, .has-success.radio label, .has-success.checkbox label, .has-success.radio-inline label, .has-success.checkbox-inline label { +.has-success .checkbox-inline, +.has-success.radio label, +.has-success.checkbox label, +.has-success.radio-inline label, +.has-success.checkbox-inline label { color: #4CAF50; } + .has-success .form-control { border-color: #4CAF50; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); @@ -2735,10 +2623,12 @@ select[multiple].input-lg, border-color: #3d8b40; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #92cf94; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #92cf94; } + .has-success .input-group-addon { color: #4CAF50; border-color: #4CAF50; background-color: #dff0d8; } + .has-success .form-control-feedback { color: #4CAF50; } @@ -2747,8 +2637,13 @@ select[multiple].input-lg, .has-warning .radio, .has-warning .checkbox, .has-warning .radio-inline, -.has-warning .checkbox-inline, .has-warning.radio label, .has-warning.checkbox label, .has-warning.radio-inline label, .has-warning.checkbox-inline label { +.has-warning .checkbox-inline, +.has-warning.radio label, +.has-warning.checkbox label, +.has-warning.radio-inline label, +.has-warning.checkbox-inline label { color: #ff9800; } + .has-warning .form-control { border-color: #ff9800; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); @@ -2757,10 +2652,12 @@ select[multiple].input-lg, border-color: #cc7a00; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ffc166; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ffc166; } + .has-warning .input-group-addon { color: #ff9800; border-color: #ff9800; background-color: #ffe0b2; } + .has-warning .form-control-feedback { color: #ff9800; } @@ -2769,8 +2666,13 @@ select[multiple].input-lg, .has-error .radio, .has-error .checkbox, .has-error .radio-inline, -.has-error .checkbox-inline, .has-error.radio label, .has-error.checkbox label, .has-error.radio-inline label, .has-error.checkbox-inline label { +.has-error .checkbox-inline, +.has-error.radio label, +.has-error.checkbox label, +.has-error.radio-inline label, +.has-error.checkbox-inline label { color: #e51c23; } + .has-error .form-control { border-color: #e51c23; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); @@ -2779,15 +2681,18 @@ select[multiple].input-lg, border-color: #b9151b; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ef787c; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ef787c; } + .has-error .input-group-addon { color: #e51c23; border-color: #e51c23; background-color: #f9bdbb; } + .has-error .form-control-feedback { color: #e51c23; } .has-feedback label ~ .form-control-feedback { top: 32px; } + .has-feedback label.sr-only ~ .form-control-feedback { top: 0; } @@ -2843,9 +2748,11 @@ select[multiple].input-lg, margin-top: 0; margin-bottom: 0; padding-top: 7px; } + .form-horizontal .radio, .form-horizontal .checkbox { min-height: 34px; } + .form-horizontal .form-group { margin-left: -15px; margin-right: -15px; } @@ -2854,17 +2761,21 @@ select[multiple].input-lg, display: table; } .form-horizontal .form-group:after { clear: both; } + @media (min-width: 768px) { .form-horizontal .control-label { text-align: right; margin-bottom: 0; padding-top: 7px; } } + .form-horizontal .has-feedback .form-control-feedback { right: 15px; } + @media (min-width: 768px) { .form-horizontal .form-group-lg .control-label { padding-top: 11px; font-size: 19px; } } + @media (min-width: 768px) { .form-horizontal .form-group-sm .control-label { padding-top: 6px; @@ -2900,14 +2811,16 @@ select[multiple].input-lg, background-image: none; -webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); } - .btn.disabled, .btn[disabled], fieldset[disabled] .btn { + .btn.disabled, .btn[disabled], + fieldset[disabled] .btn { cursor: not-allowed; opacity: 0.65; filter: alpha(opacity=65); -webkit-box-shadow: none; box-shadow: none; } -a.btn.disabled, fieldset[disabled] a.btn { +a.btn.disabled, +fieldset[disabled] a.btn { pointer-events: none; } .btn-default { @@ -2917,22 +2830,30 @@ a.btn.disabled, fieldset[disabled] a.btn { .btn-default:focus, .btn-default.focus { color: #444; background-color: #e6e6e6; - border-color: transparent; } + border-color: rgba(0, 0, 0, 0); } .btn-default:hover { color: #444; background-color: #e6e6e6; - border-color: transparent; } - .btn-default:active, .btn-default.active, .open > .btn-default.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-default:active, .btn-default.active, + .open > .btn-default.dropdown-toggle { color: #444; background-color: #e6e6e6; - border-color: transparent; } - .btn-default:active:hover, .btn-default:active:focus, .btn-default:active.focus, .btn-default.active:hover, .btn-default.active:focus, .btn-default.active.focus, .open > .btn-default.dropdown-toggle:hover, .open > .btn-default.dropdown-toggle:focus, .open > .btn-default.dropdown-toggle.focus { + border-color: rgba(0, 0, 0, 0); } + .btn-default:active:hover, .btn-default:active:focus, .btn-default:active.focus, .btn-default.active:hover, .btn-default.active:focus, .btn-default.active.focus, + .open > .btn-default.dropdown-toggle:hover, + .open > .btn-default.dropdown-toggle:focus, + .open > .btn-default.dropdown-toggle.focus { color: #444; background-color: #d4d4d4; - border-color: transparent; } - .btn-default:active, .btn-default.active, .open > .btn-default.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-default:active, .btn-default.active, + .open > .btn-default.dropdown-toggle { background-image: none; } - .btn-default.disabled:hover, .btn-default.disabled:focus, .btn-default.disabled.focus, .btn-default[disabled]:hover, .btn-default[disabled]:focus, .btn-default[disabled].focus, fieldset[disabled] .btn-default:hover, fieldset[disabled] .btn-default:focus, fieldset[disabled] .btn-default.focus { + .btn-default.disabled:hover, .btn-default.disabled:focus, .btn-default.disabled.focus, .btn-default[disabled]:hover, .btn-default[disabled]:focus, .btn-default[disabled].focus, + fieldset[disabled] .btn-default:hover, + fieldset[disabled] .btn-default:focus, + fieldset[disabled] .btn-default.focus { background-color: #fff; border-color: transparent; } .btn-default .badge { @@ -2946,22 +2867,30 @@ a.btn.disabled, fieldset[disabled] a.btn { .btn-primary:focus, .btn-primary.focus { color: #fff; background-color: #3084d2; - border-color: transparent; } + border-color: rgba(0, 0, 0, 0); } .btn-primary:hover { color: #fff; background-color: #3084d2; - border-color: transparent; } - .btn-primary:active, .btn-primary.active, .open > .btn-primary.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-primary:active, .btn-primary.active, + .open > .btn-primary.dropdown-toggle { color: #fff; background-color: #3084d2; - border-color: transparent; } - .btn-primary:active:hover, .btn-primary:active:focus, .btn-primary:active.focus, .btn-primary.active:hover, .btn-primary.active:focus, .btn-primary.active.focus, .open > .btn-primary.dropdown-toggle:hover, .open > .btn-primary.dropdown-toggle:focus, .open > .btn-primary.dropdown-toggle.focus { + border-color: rgba(0, 0, 0, 0); } + .btn-primary:active:hover, .btn-primary:active:focus, .btn-primary:active.focus, .btn-primary.active:hover, .btn-primary.active:focus, .btn-primary.active.focus, + .open > .btn-primary.dropdown-toggle:hover, + .open > .btn-primary.dropdown-toggle:focus, + .open > .btn-primary.dropdown-toggle.focus { color: #fff; background-color: #2872b6; - border-color: transparent; } - .btn-primary:active, .btn-primary.active, .open > .btn-primary.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-primary:active, .btn-primary.active, + .open > .btn-primary.dropdown-toggle { background-image: none; } - .btn-primary.disabled:hover, .btn-primary.disabled:focus, .btn-primary.disabled.focus, .btn-primary[disabled]:hover, .btn-primary[disabled]:focus, .btn-primary[disabled].focus, fieldset[disabled] .btn-primary:hover, fieldset[disabled] .btn-primary:focus, fieldset[disabled] .btn-primary.focus { + .btn-primary.disabled:hover, .btn-primary.disabled:focus, .btn-primary.disabled.focus, .btn-primary[disabled]:hover, .btn-primary[disabled]:focus, .btn-primary[disabled].focus, + fieldset[disabled] .btn-primary:hover, + fieldset[disabled] .btn-primary:focus, + fieldset[disabled] .btn-primary.focus { background-color: #5a9ddb; border-color: transparent; } .btn-primary .badge { @@ -2975,22 +2904,30 @@ a.btn.disabled, fieldset[disabled] a.btn { .btn-success:focus, .btn-success.focus { color: #fff; background-color: #3d8b40; - border-color: transparent; } + border-color: rgba(0, 0, 0, 0); } .btn-success:hover { color: #fff; background-color: #3d8b40; - border-color: transparent; } - .btn-success:active, .btn-success.active, .open > .btn-success.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-success:active, .btn-success.active, + .open > .btn-success.dropdown-toggle { color: #fff; background-color: #3d8b40; - border-color: transparent; } - .btn-success:active:hover, .btn-success:active:focus, .btn-success:active.focus, .btn-success.active:hover, .btn-success.active:focus, .btn-success.active.focus, .open > .btn-success.dropdown-toggle:hover, .open > .btn-success.dropdown-toggle:focus, .open > .btn-success.dropdown-toggle.focus { + border-color: rgba(0, 0, 0, 0); } + .btn-success:active:hover, .btn-success:active:focus, .btn-success:active.focus, .btn-success.active:hover, .btn-success.active:focus, .btn-success.active.focus, + .open > .btn-success.dropdown-toggle:hover, + .open > .btn-success.dropdown-toggle:focus, + .open > .btn-success.dropdown-toggle.focus { color: #fff; background-color: #327334; - border-color: transparent; } - .btn-success:active, .btn-success.active, .open > .btn-success.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-success:active, .btn-success.active, + .open > .btn-success.dropdown-toggle { background-image: none; } - .btn-success.disabled:hover, .btn-success.disabled:focus, .btn-success.disabled.focus, .btn-success[disabled]:hover, .btn-success[disabled]:focus, .btn-success[disabled].focus, fieldset[disabled] .btn-success:hover, fieldset[disabled] .btn-success:focus, fieldset[disabled] .btn-success.focus { + .btn-success.disabled:hover, .btn-success.disabled:focus, .btn-success.disabled.focus, .btn-success[disabled]:hover, .btn-success[disabled]:focus, .btn-success[disabled].focus, + fieldset[disabled] .btn-success:hover, + fieldset[disabled] .btn-success:focus, + fieldset[disabled] .btn-success.focus { background-color: #4CAF50; border-color: transparent; } .btn-success .badge { @@ -3004,22 +2941,30 @@ a.btn.disabled, fieldset[disabled] a.btn { .btn-info:focus, .btn-info.focus { color: #fff; background-color: #771e86; - border-color: transparent; } + border-color: rgba(0, 0, 0, 0); } .btn-info:hover { color: #fff; background-color: #771e86; - border-color: transparent; } - .btn-info:active, .btn-info.active, .open > .btn-info.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-info:active, .btn-info.active, + .open > .btn-info.dropdown-toggle { color: #fff; background-color: #771e86; - border-color: transparent; } - .btn-info:active:hover, .btn-info:active:focus, .btn-info:active.focus, .btn-info.active:hover, .btn-info.active:focus, .btn-info.active.focus, .open > .btn-info.dropdown-toggle:hover, .open > .btn-info.dropdown-toggle:focus, .open > .btn-info.dropdown-toggle.focus { + border-color: rgba(0, 0, 0, 0); } + .btn-info:active:hover, .btn-info:active:focus, .btn-info:active.focus, .btn-info.active:hover, .btn-info.active:focus, .btn-info.active.focus, + .open > .btn-info.dropdown-toggle:hover, + .open > .btn-info.dropdown-toggle:focus, + .open > .btn-info.dropdown-toggle.focus { color: #fff; background-color: #5d1769; - border-color: transparent; } - .btn-info:active, .btn-info.active, .open > .btn-info.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-info:active, .btn-info.active, + .open > .btn-info.dropdown-toggle { background-image: none; } - .btn-info.disabled:hover, .btn-info.disabled:focus, .btn-info.disabled.focus, .btn-info[disabled]:hover, .btn-info[disabled]:focus, .btn-info[disabled].focus, fieldset[disabled] .btn-info:hover, fieldset[disabled] .btn-info:focus, fieldset[disabled] .btn-info.focus { + .btn-info.disabled:hover, .btn-info.disabled:focus, .btn-info.disabled.focus, .btn-info[disabled]:hover, .btn-info[disabled]:focus, .btn-info[disabled].focus, + fieldset[disabled] .btn-info:hover, + fieldset[disabled] .btn-info:focus, + fieldset[disabled] .btn-info.focus { background-color: #9C27B0; border-color: transparent; } .btn-info .badge { @@ -3033,22 +2978,30 @@ a.btn.disabled, fieldset[disabled] a.btn { .btn-warning:focus, .btn-warning.focus { color: #fff; background-color: #cc7a00; - border-color: transparent; } + border-color: rgba(0, 0, 0, 0); } .btn-warning:hover { color: #fff; background-color: #cc7a00; - border-color: transparent; } - .btn-warning:active, .btn-warning.active, .open > .btn-warning.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-warning:active, .btn-warning.active, + .open > .btn-warning.dropdown-toggle { color: #fff; background-color: #cc7a00; - border-color: transparent; } - .btn-warning:active:hover, .btn-warning:active:focus, .btn-warning:active.focus, .btn-warning.active:hover, .btn-warning.active:focus, .btn-warning.active.focus, .open > .btn-warning.dropdown-toggle:hover, .open > .btn-warning.dropdown-toggle:focus, .open > .btn-warning.dropdown-toggle.focus { + border-color: rgba(0, 0, 0, 0); } + .btn-warning:active:hover, .btn-warning:active:focus, .btn-warning:active.focus, .btn-warning.active:hover, .btn-warning.active:focus, .btn-warning.active.focus, + .open > .btn-warning.dropdown-toggle:hover, + .open > .btn-warning.dropdown-toggle:focus, + .open > .btn-warning.dropdown-toggle.focus { color: #fff; background-color: #a86400; - border-color: transparent; } - .btn-warning:active, .btn-warning.active, .open > .btn-warning.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-warning:active, .btn-warning.active, + .open > .btn-warning.dropdown-toggle { background-image: none; } - .btn-warning.disabled:hover, .btn-warning.disabled:focus, .btn-warning.disabled.focus, .btn-warning[disabled]:hover, .btn-warning[disabled]:focus, .btn-warning[disabled].focus, fieldset[disabled] .btn-warning:hover, fieldset[disabled] .btn-warning:focus, fieldset[disabled] .btn-warning.focus { + .btn-warning.disabled:hover, .btn-warning.disabled:focus, .btn-warning.disabled.focus, .btn-warning[disabled]:hover, .btn-warning[disabled]:focus, .btn-warning[disabled].focus, + fieldset[disabled] .btn-warning:hover, + fieldset[disabled] .btn-warning:focus, + fieldset[disabled] .btn-warning.focus { background-color: #ff9800; border-color: transparent; } .btn-warning .badge { @@ -3062,22 +3015,30 @@ a.btn.disabled, fieldset[disabled] a.btn { .btn-danger:focus, .btn-danger.focus { color: #fff; background-color: #b9151b; - border-color: transparent; } + border-color: rgba(0, 0, 0, 0); } .btn-danger:hover { color: #fff; background-color: #b9151b; - border-color: transparent; } - .btn-danger:active, .btn-danger.active, .open > .btn-danger.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-danger:active, .btn-danger.active, + .open > .btn-danger.dropdown-toggle { color: #fff; background-color: #b9151b; - border-color: transparent; } - .btn-danger:active:hover, .btn-danger:active:focus, .btn-danger:active.focus, .btn-danger.active:hover, .btn-danger.active:focus, .btn-danger.active.focus, .open > .btn-danger.dropdown-toggle:hover, .open > .btn-danger.dropdown-toggle:focus, .open > .btn-danger.dropdown-toggle.focus { + border-color: rgba(0, 0, 0, 0); } + .btn-danger:active:hover, .btn-danger:active:focus, .btn-danger:active.focus, .btn-danger.active:hover, .btn-danger.active:focus, .btn-danger.active.focus, + .open > .btn-danger.dropdown-toggle:hover, + .open > .btn-danger.dropdown-toggle:focus, + .open > .btn-danger.dropdown-toggle.focus { color: #fff; background-color: #991216; - border-color: transparent; } - .btn-danger:active, .btn-danger.active, .open > .btn-danger.dropdown-toggle { + border-color: rgba(0, 0, 0, 0); } + .btn-danger:active, .btn-danger.active, + .open > .btn-danger.dropdown-toggle { background-image: none; } - .btn-danger.disabled:hover, .btn-danger.disabled:focus, .btn-danger.disabled.focus, .btn-danger[disabled]:hover, .btn-danger[disabled]:focus, .btn-danger[disabled].focus, fieldset[disabled] .btn-danger:hover, fieldset[disabled] .btn-danger:focus, fieldset[disabled] .btn-danger.focus { + .btn-danger.disabled:hover, .btn-danger.disabled:focus, .btn-danger.disabled.focus, .btn-danger[disabled]:hover, .btn-danger[disabled]:focus, .btn-danger[disabled].focus, + fieldset[disabled] .btn-danger:hover, + fieldset[disabled] .btn-danger:focus, + fieldset[disabled] .btn-danger.focus { background-color: #e51c23; border-color: transparent; } .btn-danger .badge { @@ -3088,7 +3049,8 @@ a.btn.disabled, fieldset[disabled] a.btn { color: #5a9ddb; font-weight: normal; border-radius: 0; } - .btn-link, .btn-link:active, .btn-link.active, .btn-link[disabled], fieldset[disabled] .btn-link { + .btn-link, .btn-link:active, .btn-link.active, .btn-link[disabled], + fieldset[disabled] .btn-link { background-color: transparent; -webkit-box-shadow: none; box-shadow: none; } @@ -3098,7 +3060,9 @@ a.btn.disabled, fieldset[disabled] a.btn { color: #2a77bf; text-decoration: underline; background-color: transparent; } - .btn-link[disabled]:hover, .btn-link[disabled]:focus, fieldset[disabled] .btn-link:hover, fieldset[disabled] .btn-link:focus { + .btn-link[disabled]:hover, .btn-link[disabled]:focus, + fieldset[disabled] .btn-link:hover, + fieldset[disabled] .btn-link:focus { color: #bbb; text-decoration: none; } @@ -3230,6 +3194,7 @@ tbody.collapse.in { .dropdown-menu > .disabled > a, .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { color: #bbb; } + .dropdown-menu > .disabled > a:hover, .dropdown-menu > .disabled > a:focus { text-decoration: none; background-color: transparent; @@ -3239,6 +3204,7 @@ tbody.collapse.in { .open > .dropdown-menu { display: block; } + .open > a { outline: 0; } @@ -3276,6 +3242,7 @@ tbody.collapse.in { border-bottom: 4px dashed; border-bottom: 4px solid \9; content: ""; } + .dropup .dropdown-menu, .navbar-fixed-bottom .dropdown .dropdown-menu { top: auto; @@ -3289,6 +3256,7 @@ tbody.collapse.in { .navbar-right .dropdown-menu-left { left: 0; right: auto; } } + .btn-group, .btn-group-vertical { position: relative; @@ -3392,13 +3360,17 @@ tbody.collapse.in { float: none; width: 100%; max-width: 100%; } + .btn-group-vertical > .btn-group:before, .btn-group-vertical > .btn-group:after { content: " "; display: table; } + .btn-group-vertical > .btn-group:after { clear: both; } + .btn-group-vertical > .btn-group > .btn { float: none; } + .btn-group-vertical > .btn + .btn, .btn-group-vertical > .btn + .btn-group, .btn-group-vertical > .btn-group + .btn, @@ -3408,11 +3380,13 @@ tbody.collapse.in { .btn-group-vertical > .btn:not(:first-child):not(:last-child) { border-radius: 0; } + .btn-group-vertical > .btn:first-child:not(:last-child) { border-top-right-radius: 3px; border-top-left-radius: 3px; border-bottom-right-radius: 0; border-bottom-left-radius: 0; } + .btn-group-vertical > .btn:last-child:not(:first-child) { border-top-right-radius: 0; border-top-left-radius: 0; @@ -3669,6 +3643,7 @@ tbody.collapse.in { .tab-content > .tab-pane { display: none; } + .tab-content > .active { display: block; } @@ -3694,8 +3669,10 @@ tbody.collapse.in { .navbar-header:before, .navbar-header:after { content: " "; display: table; } + .navbar-header:after { clear: both; } + @media (min-width: 768px) { .navbar-header { float: left; } } @@ -3726,7 +3703,9 @@ tbody.collapse.in { overflow: visible !important; } .navbar-collapse.in { overflow-y: visible; } - .navbar-fixed-top .navbar-collapse, .navbar-static-top .navbar-collapse, .navbar-fixed-bottom .navbar-collapse { + .navbar-fixed-top .navbar-collapse, + .navbar-static-top .navbar-collapse, + .navbar-fixed-bottom .navbar-collapse { padding-left: 0; padding-right: 0; } } @@ -3790,7 +3769,8 @@ tbody.collapse.in { .navbar-brand > img { display: block; } @media (min-width: 768px) { - .navbar > .container .navbar-brand, .navbar > .container-fluid .navbar-brand { + .navbar > .container .navbar-brand, + .navbar > .container-fluid .navbar-brand { margin-left: -15px; } } .navbar-toggle { @@ -3947,12 +3927,12 @@ tbody.collapse.in { @media (min-width: 768px) { .navbar-left { float: left !important; } - .navbar-right { float: right !important; margin-right: -15px; } .navbar-right ~ .navbar-right { margin-right: 0; } } + .navbar-default { background-color: #fff; border-color: transparent; } @@ -4006,7 +3986,9 @@ tbody.collapse.in { color: #444; } .navbar-default .btn-link:hover, .navbar-default .btn-link:focus { color: #222; } - .navbar-default .btn-link[disabled]:hover, .navbar-default .btn-link[disabled]:focus, fieldset[disabled] .navbar-default .btn-link:hover, fieldset[disabled] .navbar-default .btn-link:focus { + .navbar-default .btn-link[disabled]:hover, .navbar-default .btn-link[disabled]:focus, + fieldset[disabled] .navbar-default .btn-link:hover, + fieldset[disabled] .navbar-default .btn-link:focus { color: #ccc; } .navbar-inverse { @@ -4066,7 +4048,9 @@ tbody.collapse.in { color: #d8e8f6; } .navbar-inverse .btn-link:hover, .navbar-inverse .btn-link:focus { color: #fff; } - .navbar-inverse .btn-link[disabled]:hover, .navbar-inverse .btn-link[disabled]:focus, fieldset[disabled] .navbar-inverse .btn-link:hover, fieldset[disabled] .navbar-inverse .btn-link:focus { + .navbar-inverse .btn-link[disabled]:hover, .navbar-inverse .btn-link[disabled]:focus, + fieldset[disabled] .navbar-inverse .btn-link:hover, + fieldset[disabled] .navbar-inverse .btn-link:focus { color: #444; } .breadcrumb { @@ -4143,10 +4127,12 @@ tbody.collapse.in { padding: 10px 16px; font-size: 19px; line-height: 1.33333; } + .pagination-lg > li:first-child > a, .pagination-lg > li:first-child > span { border-bottom-left-radius: 3px; border-top-left-radius: 3px; } + .pagination-lg > li:last-child > a, .pagination-lg > li:last-child > span { border-bottom-right-radius: 3px; @@ -4157,10 +4143,12 @@ tbody.collapse.in { padding: 5px 10px; font-size: 13px; line-height: 1.5; } + .pagination-sm > li:first-child > a, .pagination-sm > li:first-child > span { border-bottom-left-radius: 3px; border-top-left-radius: 3px; } + .pagination-sm > li:last-child > a, .pagination-sm > li:last-child > span { border-bottom-right-radius: 3px; @@ -4273,10 +4261,12 @@ a.label:hover, a.label:focus { .btn .badge { position: relative; top: -1px; } - .btn-xs .badge, .btn-group-xs > .btn .badge, .btn-group-xs > .btn .badge { + .btn-xs .badge, .btn-group-xs > .btn .badge, + .btn-group-xs > .btn .badge { top: 0; padding: 1px 5px; } - .list-group-item.active > .badge, .nav-pills > .active > a > .badge { + .list-group-item.active > .badge, + .nav-pills > .active > a > .badge { color: #5a9ddb; background-color: #fff; } .list-group-item > .badge { @@ -4306,7 +4296,8 @@ a.badge:hover, a.badge:focus { font-weight: 200; } .jumbotron > hr { border-top-color: gainsboro; } - .container .jumbotron, .container-fluid .jumbotron { + .container .jumbotron, + .container-fluid .jumbotron { border-radius: 3px; padding-left: 15px; padding-right: 15px; } @@ -4316,7 +4307,8 @@ a.badge:hover, a.badge:focus { .jumbotron { padding-top: 48px; padding-bottom: 48px; } - .container .jumbotron, .container-fluid .jumbotron { + .container .jumbotron, + .container-fluid .jumbotron { padding-left: 60px; padding-right: 60px; } .jumbotron h1, @@ -4417,11 +4409,13 @@ a.thumbnail.active { background-position: 40px 0; } to { background-position: 0 0; } } + @keyframes progress-bar-stripes { from { background-position: 40px 0; } to { background-position: 0 0; } } + .progress { overflow: hidden; height: 27px; @@ -4577,6 +4571,7 @@ button.list-group-item { color: inherit; } .list-group-item.disabled .list-group-item-text, .list-group-item.disabled:hover .list-group-item-text, .list-group-item.disabled:focus .list-group-item-text { color: #bbb; } + .list-group-item.active, .list-group-item.active:hover, .list-group-item.active:focus { z-index: 2; color: #fff; @@ -4753,6 +4748,7 @@ button.list-group-item-danger { border-bottom: 0; border-bottom-right-radius: 2px; border-bottom-left-radius: 2px; } + .panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child { border-top-right-radius: 0; border-top-left-radius: 0; } @@ -4772,6 +4768,7 @@ button.list-group-item-danger { .panel > .panel-collapse > .table caption { padding-left: 15px; padding-right: 15px; } + .panel > .table:first-child, .panel > .table-responsive:first-child > .table:first-child { border-top-right-radius: 2px; @@ -4800,6 +4797,7 @@ button.list-group-item-danger { .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child, .panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child { border-top-right-radius: 2px; } + .panel > .table:last-child, .panel > .table-responsive:last-child > .table:last-child { border-bottom-right-radius: 2px; @@ -4828,14 +4826,17 @@ button.list-group-item-danger { .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child, .panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child { border-bottom-right-radius: 2px; } + .panel > .panel-body + .table, .panel > .panel-body + .table-responsive, .panel > .table + .panel-body, .panel > .table-responsive + .panel-body { border-top: 1px solid #ddd; } + .panel > .table > tbody:first-child > tr:first-child th, .panel > .table > tbody:first-child > tr:first-child td { border-top: 0; } + .panel > .table-bordered, .panel > .table-responsive > .table-bordered { border: 0; } @@ -4883,6 +4884,7 @@ button.list-group-item-danger { .panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td, .panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th { border-bottom: 0; } + .panel > .table-responsive { border: 0; margin-bottom: 0; } @@ -5169,16 +5171,16 @@ button.close { .modal-dialog { width: 600px; margin: 30px auto; } - .modal-content { -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); } - .modal-sm { width: 300px; } } + @media (min-width: 992px) { .modal-lg { width: 900px; } } + .tooltip { position: absolute; z-index: 1070; @@ -5238,42 +5240,49 @@ button.close { margin-left: -5px; border-width: 5px 5px 0; border-top-color: #727272; } + .tooltip.top-left .tooltip-arrow { bottom: 0; right: 5px; margin-bottom: -5px; border-width: 5px 5px 0; border-top-color: #727272; } + .tooltip.top-right .tooltip-arrow { bottom: 0; left: 5px; margin-bottom: -5px; border-width: 5px 5px 0; border-top-color: #727272; } + .tooltip.right .tooltip-arrow { top: 50%; left: 0; margin-top: -5px; border-width: 5px 5px 5px 0; border-right-color: #727272; } + .tooltip.left .tooltip-arrow { top: 50%; right: 0; margin-top: -5px; border-width: 5px 0 5px 5px; border-left-color: #727272; } + .tooltip.bottom .tooltip-arrow { top: 0; left: 50%; margin-left: -5px; border-width: 0 5px 5px; border-bottom-color: #727272; } + .tooltip.bottom-left .tooltip-arrow { top: 0; right: 5px; margin-top: -5px; border-width: 0 5px 5px; border-bottom-color: #727272; } + .tooltip.bottom-right .tooltip-arrow { top: 0; left: 5px; @@ -5351,7 +5360,7 @@ button.close { left: 50%; margin-left: -11px; border-bottom-width: 0; - border-top-color: transparent; + border-top-color: rgba(0, 0, 0, 0); border-top-color: fadein(transparent, 12%); bottom: -11px; } .popover.top > .arrow:after { @@ -5360,12 +5369,13 @@ button.close { margin-left: -10px; border-bottom-width: 0; border-top-color: #fff; } + .popover.right > .arrow { top: 50%; left: -11px; margin-top: -11px; border-left-width: 0; - border-right-color: transparent; + border-right-color: rgba(0, 0, 0, 0); border-right-color: fadein(transparent, 12%); } .popover.right > .arrow:after { content: " "; @@ -5373,11 +5383,12 @@ button.close { bottom: -10px; border-left-width: 0; border-right-color: #fff; } + .popover.bottom > .arrow { left: 50%; margin-left: -11px; border-top-width: 0; - border-bottom-color: transparent; + border-bottom-color: rgba(0, 0, 0, 0); border-bottom-color: fadein(transparent, 12%); top: -11px; } .popover.bottom > .arrow:after { @@ -5386,12 +5397,13 @@ button.close { margin-left: -10px; border-top-width: 0; border-bottom-color: #fff; } + .popover.left > .arrow { top: 50%; right: -11px; margin-top: -11px; border-right-width: 0; - border-left-color: transparent; + border-left-color: rgba(0, 0, 0, 0); border-left-color: fadein(transparent, 12%); } .popover.left > .arrow:after { content: " "; @@ -5478,7 +5490,7 @@ button.close { color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); - background-color: transparent; } + background-color: rgba(0, 0, 0, 0); } .carousel-control.left { background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%); @@ -5547,7 +5559,7 @@ button.close { border-radius: 10px; cursor: pointer; background-color: #000 \9; - background-color: transparent; } + background-color: rgba(0, 0, 0, 0); } .carousel-indicators .active { margin: 0; width: 12px; @@ -5583,17 +5595,17 @@ button.close { .carousel-control .glyphicon-chevron-right, .carousel-control .icon-next { margin-right: -10px; } - .carousel-caption { left: 20%; right: 20%; padding-bottom: 30px; } - .carousel-indicators { bottom: 20px; } } + .clearfix:before, .clearfix:after { content: " "; display: table; } + .clearfix:after { clear: both; } @@ -5632,6 +5644,7 @@ button.close { @-ms-viewport { width: device-width; } + .visible-xs { display: none !important; } @@ -5661,16 +5674,14 @@ button.close { @media (max-width: 767px) { .visible-xs { display: block !important; } - table.visible-xs { display: table !important; } - tr.visible-xs { display: table-row !important; } - th.visible-xs, td.visible-xs { display: table-cell !important; } } + @media (max-width: 767px) { .visible-xs-block { display: block !important; } } @@ -5686,16 +5697,14 @@ button.close { @media (min-width: 768px) and (max-width: 991px) { .visible-sm { display: block !important; } - table.visible-sm { display: table !important; } - tr.visible-sm { display: table-row !important; } - th.visible-sm, td.visible-sm { display: table-cell !important; } } + @media (min-width: 768px) and (max-width: 991px) { .visible-sm-block { display: block !important; } } @@ -5711,16 +5720,14 @@ button.close { @media (min-width: 992px) and (max-width: 1199px) { .visible-md { display: block !important; } - table.visible-md { display: table !important; } - tr.visible-md { display: table-row !important; } - th.visible-md, td.visible-md { display: table-cell !important; } } + @media (min-width: 992px) and (max-width: 1199px) { .visible-md-block { display: block !important; } } @@ -5736,16 +5743,14 @@ button.close { @media (min-width: 1200px) { .visible-lg { display: block !important; } - table.visible-lg { display: table !important; } - tr.visible-lg { display: table-row !important; } - th.visible-lg, td.visible-lg { display: table-cell !important; } } + @media (min-width: 1200px) { .visible-lg-block { display: block !important; } } @@ -5761,31 +5766,33 @@ button.close { @media (max-width: 767px) { .hidden-xs { display: none !important; } } + @media (min-width: 768px) and (max-width: 991px) { .hidden-sm { display: none !important; } } + @media (min-width: 992px) and (max-width: 1199px) { .hidden-md { display: none !important; } } + @media (min-width: 1200px) { .hidden-lg { display: none !important; } } + .visible-print { display: none !important; } @media print { .visible-print { display: block !important; } - table.visible-print { display: table !important; } - tr.visible-print { display: table-row !important; } - th.visible-print, td.visible-print { display: table-cell !important; } } + .visible-print-block { display: none !important; } @media print { @@ -5807,6 +5814,7 @@ button.close { @media print { .hidden-print { display: none !important; } } + /*! * tidyverse theme * Copyright 2016 RStudio, Inc. @@ -5854,56 +5862,70 @@ button.close { .btn-default:focus { background-color: #fff; } + .btn-default:hover, .btn-default:active:hover { background-color: #f0f0f0; } + .btn-default:active { -webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); } .btn-primary:focus { background-color: #5a9ddb; } + .btn-primary:hover, .btn-primary:active:hover { background-color: #418ed6; } + .btn-primary:active { -webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); } .btn-success:focus { background-color: #4CAF50; } + .btn-success:hover, .btn-success:active:hover { background-color: #439a46; } + .btn-success:active { -webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); } .btn-info:focus { background-color: #9C27B0; } + .btn-info:hover, .btn-info:active:hover { background-color: #862197; } + .btn-info:active { -webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); } .btn-warning:focus { background-color: #ff9800; } + .btn-warning:hover, .btn-warning:active:hover { background-color: #e08600; } + .btn-warning:active { -webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); } .btn-danger:focus { background-color: #e51c23; } + .btn-danger:hover, .btn-danger:active:hover { background-color: #cb171e; } + .btn-danger:active { -webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); } .btn-link:focus { background-color: #fff; } + .btn-link:hover, .btn-link:active:hover { background-color: #f0f0f0; } + .btn-link:active { -webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4); } @@ -5957,6 +5979,7 @@ button.close { .btn-group .btn-group + .btn, .btn-group .btn-group + .btn-group { margin-left: 0; } + .btn-group-vertical > .btn + .btn, .btn-group-vertical > .btn + .btn-group, .btn-group-vertical > .btn-group + .btn, @@ -6059,36 +6082,36 @@ input[type=number], .input-group-sm > input.form-control, .input-group-sm > .input-group-btn > input.form-control.btn, input[type=text].input-sm, - .input-group-sm > input[type=text].form-control, - .input-group-sm > input[type=text].input-group-addon, - .input-group-sm > .input-group-btn > input[type=text].btn, + .input-group-sm > input.form-control[type=text], + .input-group-sm > input.input-group-addon[type=text], + .input-group-sm > .input-group-btn > input.btn[type=text], input[type=password].input-sm, - .input-group-sm > input[type=password].form-control, - .input-group-sm > input[type=password].input-group-addon, - .input-group-sm > .input-group-btn > input[type=password].btn, + .input-group-sm > input.form-control[type=password], + .input-group-sm > input.input-group-addon[type=password], + .input-group-sm > .input-group-btn > input.btn[type=password], input[type=email].input-sm, - .input-group-sm > input[type=email].form-control, - .input-group-sm > input[type=email].input-group-addon, - .input-group-sm > .input-group-btn > input[type=email].btn, + .input-group-sm > input.form-control[type=email], + .input-group-sm > input.input-group-addon[type=email], + .input-group-sm > .input-group-btn > input.btn[type=email], input[type=number].input-sm, - .input-group-sm > input[type=number].form-control, - .input-group-sm > input[type=number].input-group-addon, - .input-group-sm > .input-group-btn > input[type=number].btn, + .input-group-sm > input.form-control[type=number], + .input-group-sm > input.input-group-addon[type=number], + .input-group-sm > .input-group-btn > input.btn[type=number], [type=text].form-control.input-sm, .input-group-sm > [type=text].form-control, - .input-group-sm > .input-group-btn > [type=text].form-control.btn, + .input-group-sm > .input-group-btn > .btn[type=text].form-control, [type=password].form-control.input-sm, .input-group-sm > [type=password].form-control, - .input-group-sm > .input-group-btn > [type=password].form-control.btn, + .input-group-sm > .input-group-btn > .btn[type=password].form-control, [type=email].form-control.input-sm, .input-group-sm > [type=email].form-control, - .input-group-sm > .input-group-btn > [type=email].form-control.btn, + .input-group-sm > .input-group-btn > .btn[type=email].form-control, [type=tel].form-control.input-sm, .input-group-sm > [type=tel].form-control, - .input-group-sm > .input-group-btn > [type=tel].form-control.btn, + .input-group-sm > .input-group-btn > .btn[type=tel].form-control, [contenteditable].form-control.input-sm, .input-group-sm > [contenteditable].form-control, - .input-group-sm > .input-group-btn > [contenteditable].form-control.btn { + .input-group-sm > .input-group-btn > .btn[contenteditable].form-control { font-size: 13px; } textarea.input-lg, .input-group-lg > textarea.form-control, .input-group-lg > textarea.input-group-addon, @@ -6100,36 +6123,36 @@ input[type=number], .input-group-lg > input.form-control, .input-group-lg > .input-group-btn > input.form-control.btn, input[type=text].input-lg, - .input-group-lg > input[type=text].form-control, - .input-group-lg > input[type=text].input-group-addon, - .input-group-lg > .input-group-btn > input[type=text].btn, + .input-group-lg > input.form-control[type=text], + .input-group-lg > input.input-group-addon[type=text], + .input-group-lg > .input-group-btn > input.btn[type=text], input[type=password].input-lg, - .input-group-lg > input[type=password].form-control, - .input-group-lg > input[type=password].input-group-addon, - .input-group-lg > .input-group-btn > input[type=password].btn, + .input-group-lg > input.form-control[type=password], + .input-group-lg > input.input-group-addon[type=password], + .input-group-lg > .input-group-btn > input.btn[type=password], input[type=email].input-lg, - .input-group-lg > input[type=email].form-control, - .input-group-lg > input[type=email].input-group-addon, - .input-group-lg > .input-group-btn > input[type=email].btn, + .input-group-lg > input.form-control[type=email], + .input-group-lg > input.input-group-addon[type=email], + .input-group-lg > .input-group-btn > input.btn[type=email], input[type=number].input-lg, - .input-group-lg > input[type=number].form-control, - .input-group-lg > input[type=number].input-group-addon, - .input-group-lg > .input-group-btn > input[type=number].btn, + .input-group-lg > input.form-control[type=number], + .input-group-lg > input.input-group-addon[type=number], + .input-group-lg > .input-group-btn > input.btn[type=number], [type=text].form-control.input-lg, .input-group-lg > [type=text].form-control, - .input-group-lg > .input-group-btn > [type=text].form-control.btn, + .input-group-lg > .input-group-btn > .btn[type=text].form-control, [type=password].form-control.input-lg, .input-group-lg > [type=password].form-control, - .input-group-lg > .input-group-btn > [type=password].form-control.btn, + .input-group-lg > .input-group-btn > .btn[type=password].form-control, [type=email].form-control.input-lg, .input-group-lg > [type=email].form-control, - .input-group-lg > .input-group-btn > [type=email].form-control.btn, + .input-group-lg > .input-group-btn > .btn[type=email].form-control, [type=tel].form-control.input-lg, .input-group-lg > [type=tel].form-control, - .input-group-lg > .input-group-btn > [type=tel].form-control.btn, + .input-group-lg > .input-group-btn > .btn[type=tel].form-control, [contenteditable].form-control.input-lg, .input-group-lg > [contenteditable].form-control, - .input-group-lg > .input-group-btn > [contenteditable].form-control.btn { + .input-group-lg > .input-group-btn > .btn[contenteditable].form-control { font-size: 19px; } select, @@ -6180,6 +6203,7 @@ select.form-control { .checkbox label, .checkbox-inline label { padding-left: 25px; } + .radio input[type="radio"], .radio input[type="checkbox"], .radio-inline input[type="radio"], @@ -6380,19 +6404,30 @@ input[type="checkbox"], -webkit-box-shadow: inset 0 -2px 0 #5a9ddb; box-shadow: inset 0 -2px 0 #5a9ddb; color: #5a9ddb; } -.nav-tabs > li.active > a, .nav-tabs > li.active > a:focus { + +.nav-tabs > li.active > a, +.nav-tabs > li.active > a:focus { border: none; -webkit-box-shadow: inset 0 -2px 0 #5a9ddb; box-shadow: inset 0 -2px 0 #5a9ddb; color: #5a9ddb; } - .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus:hover { + .nav-tabs > li.active > a:hover, + .nav-tabs > li.active > a:focus:hover { border: none; color: #5a9ddb; } + .nav-tabs > li.disabled > a { -webkit-box-shadow: inset 0 -1px 0 #ddd; box-shadow: inset 0 -1px 0 #ddd; } -.nav-tabs.nav-justified > li > a, .nav-tabs.nav-justified > li > a:hover, .nav-tabs.nav-justified > li > a:focus, .nav-tabs.nav-justified > .active > a, .nav-tabs.nav-justified > .active > a:hover, .nav-tabs.nav-justified > .active > a:focus { + +.nav-tabs.nav-justified > li > a, +.nav-tabs.nav-justified > li > a:hover, +.nav-tabs.nav-justified > li > a:focus, +.nav-tabs.nav-justified > .active > a, +.nav-tabs.nav-justified > .active > a:hover, +.nav-tabs.nav-justified > .active > a:focus { border: none; } + .nav-tabs .dropdown-menu { margin-top: 0; } @@ -6467,6 +6502,7 @@ input[type="checkbox"], .list-group-item { padding: 15px; } + .list-group-item-text { color: #bbb; } @@ -6493,4 +6529,3 @@ input[type="checkbox"], .carousel-caption h1, .carousel-caption h2, .carousel-caption h3, .carousel-caption h4, .carousel-caption h5, .carousel-caption h6 { color: inherit; } -/*# sourceMappingURL=tidyverse.css.map */ diff --git a/man/descriptors.Rd b/man/descriptors.Rd index 833cf1738..af202b3bf 100644 --- a/man/descriptors.Rd +++ b/man/descriptors.Rd @@ -39,10 +39,10 @@ function can be used. See Details below. Existing functions: \itemize{ \item \code{.obs()}: The current number of rows in the data set. -\item \code{.cols()}: The number of columns in the data set that are +\item \code{.preds()}: The number of columns in the data set that are associated with the predictors prior to dummy variable creation. -\item \code{.preds()}: The number of predictors after dummy variables -are created (if any). +\item \code{.cols()}: The number of predictor columns availible after dummy +variables are created (if any). \item \code{.facts()}: The number of factor predictors in the dat set. \item \code{.lvls()}: If the outcome is a factor, this is a table with the counts for each level (and \code{NA} otherwise). @@ -58,8 +58,8 @@ column, \code{..y}. For example, if you use the model formula \code{Sepal.Width ~ .} with the \code{iris} data, the values would be \preformatted{ - .cols() = 4 (the 4 columns in `iris`) - .preds() = 5 (3 numeric columns + 2 from Species dummy variables) + .preds() = 4 (the 4 columns in `iris`) + .cols() = 5 (3 numeric columns + 2 from Species dummy variables) .obs() = 150 .lvls() = NA (no factor outcome) .facts() = 1 (the Species predictor) @@ -70,8 +70,8 @@ data, the values would be If the formula \code{Species ~ .} where used: \preformatted{ - .cols() = 4 (the 4 numeric columns in `iris`) - .preds() = 4 (same) + .preds() = 4 (the 4 numeric columns in `iris`) + .cols() = 4 (same) .obs() = 150 .lvls() = c(setosa = 50, versicolor = 50, virginica = 50) .facts() = 0 diff --git a/man/model_fit.Rd b/man/model_fit.Rd index 80ad42d03..6a80cee54 100644 --- a/man/model_fit.Rd +++ b/man/model_fit.Rd @@ -23,6 +23,25 @@ object would contain items such as the terms object and so on. When no information is required, this is \code{NA}. } +As discussed in the documentation for \code{\link{model_spec}}, the +original arguments to the specification are saved as quosures. +These are evaluated for the \code{model_fit} object prior to fitting. +If the resulting model object prints its call, any user-defined +options are shown in the call preceded by a tilde (see the +example below). This is a result of the use of quosures in the +specification. + This class and structure is the basis for how \pkg{parsnip} stores model objects after to seeing the data and applying a model. } +\examples{ + +# Keep the `x` matrix if the data are not too big. +spec_obj <- linear_reg(x = ifelse(.obs() < 500, TRUE, FALSE)) +spec_obj + +fit_obj <- fit(spec_obj, mpg ~ ., data = mtcars, engine = "lm") +fit_obj + +nrow(fit_obj$fit$x) +} diff --git a/man/model_spec.Rd b/man/model_spec.Rd index e2a57b5d7..8202721fc 100644 --- a/man/model_spec.Rd +++ b/man/model_spec.Rd @@ -14,14 +14,15 @@ The main elements of the object are: names of these arguments may be different form their counterparts n the underlying model function. For example, for a \code{glmnet} model, the argument name for the amount of the penalty -is called "penalty" instead of "lambda" to make it more -general and usable across different types of models (and to not -be specific to a particular model function). The elements of -\code{args} can be quoted expressions or \code{varying()}. If left to -their defaults (\code{NULL}), the arguments will use the underlying -model functions default value. -\item \code{other}: An optional vector of model-function-specific -parameters. As with \code{args}, these can also be quoted or +is called "penalty" instead of "lambda" to make it more general +and usable across different types of models (and to not be +specific to a particular model function). The elements of \code{args} +can \code{varying()}. If left to their defaults (\code{NULL}), the +arguments will use the underlying model functions default value. +As discussed below, the arguments in \code{args} are captured as +quosures and are not immediately executed. +\item \code{...}: Optional model-function-specific +parameters. As with \code{args}, these will be quosures and can be \code{varying()}. \item \code{mode}: The type of model, such as "regression" or "classification". Other modes will be added once the package @@ -38,3 +39,100 @@ type. This class and structure is the basis for how \pkg{parsnip} stores model objects prior to seeing the data. } +\section{Argument Details}{ + + +An important detail to understand when creating model +specifications is that they are intended to be functionally +independent of the data. While it is true that some tuning +parameters are \emph{data dependent}, the model specification does +not interact with the data at all. + +For example, most R functions immediately evaluate their +arguments. For example, when calling \code{mean(dat_vec)}, the object +\code{dat_vec} is immediately evaluated inside of the function. + +\code{parsnip} model functions do not do this. For example, using + +\preformatted{ + rand_forest(mtry = ncol(iris) - 1) +} + +\strong{does not} execute \code{ncol(iris) - 1} when creating the specification. +This can be seen in the output: + +\preformatted{ + > rand_forest(mtry = ncol(iris) - 1) + Random Forest Model Specification (unknown) + + Main Arguments: + mtry = ncol(iris) - 1 +} + +The model functions save the argument \emph{expressions} and their +associated environments (a.k.a. a quosure) to be evaluated later +when either \code{\link[=fit]{fit()}} or \code{\link[=fit_xy]{fit_xy()}} are called with the actual +data. + +The consequence of this strategy is that any data required to +get the parameter values must be available when the model is +fit. The two main ways that this can fail is if: + +\enumerate{ +\item The data have been modified between the creation of the +model specification and when the model fit function is invoked. + +\item If the model specification is saved and loaded into a new +session where those same data objects do not exist. +} + +The best way to avoid these issues is to not reference any data +objects in the global environment but to use data descriptors +such as \code{.cols()}. Another way of writing the previous +specification is + +\preformatted{ + rand_forest(mtry = .cols() - 1) +} + +This is not dependent on any specific data object and +is evaluated immediately before the model fitting process begins. + +One less advantageous approach to solving this issue is to use +quasiquotation. This would insert the actual R object into the +model specification and might be the best idea when the data +object is small. For example, using + +\preformatted{ + rand_forest(mtry = ncol(!!iris) - 1) +} + +would work (and be reproducible between sessions) but embeds +the entire iris data set into the \code{mtry} expression: + +\preformatted{ + > rand_forest(mtry = ncol(!!iris) - 1) + Random Forest Model Specification (unknown) + + Main Arguments: + mtry = ncol(structure(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, +} + +However, if there were an object with the number of columns in +it, this wouldn't be too bad: + +\preformatted{ + > mtry_val <- ncol(iris) - 1 + > mtry_val + [1] 4 + > rand_forest(mtry = !!mtry_val) + Random Forest Model Specification (unknown) + + Main Arguments: + mtry = 4 +} + +More information on quosures and quasiquotation can be found at +\url{https://tidyeval.tidyverse.org}. +} + diff --git a/tests/testthat/test_descriptors.R b/tests/testthat/test_descriptors.R index 1f755fc6a..8210f6d3d 100644 --- a/tests/testthat/test_descriptors.R +++ b/tests/testthat/test_descriptors.R @@ -17,8 +17,8 @@ template <- function(col, pred, ob, lev, fact, dat, x, y) { eval_descrs <- function(descrs, not = NULL) { - if(!is.null(not)) { - for(descr in not) { + if (!is.null(not)) { + for (descr in not) { descrs[[descr]] <- NULL } } @@ -87,11 +87,11 @@ context("Testing formula -> xy conversion") test_that("numeric y and dummy vars", { expect_equal( - template(4, 5, 150, NA, 1, iris, iris[-2], iris[,"Sepal.Width"]), + template(5, 4, 150, NA, 1, iris, iris[-2], iris[,"Sepal.Width"]), eval_descrs(get_descr_form(Sepal.Width ~ ., data = iris)) ) expect_equal( - template(1, 2, 150, NA, 1, iris, iris["Species"], iris[,"Sepal.Width"]), + template(2, 1, 150, NA, 1, iris, iris["Species"], iris[,"Sepal.Width"]), eval_descrs(get_descr_form(Sepal.Width ~ Species, data = iris)) ) }) @@ -126,7 +126,7 @@ test_that("factor y", { test_that("factors all the way down", { dat <- npk[,1:4] expect_equal( - template(3, 7, 24, table(npk$K, dnn = NULL), 3, dat, dat[-4], dat[,"K"]), + template(7, 3, 24, table(npk$K, dnn = NULL), 3, dat, dat[-4], dat[,"K"]), eval_descrs(get_descr_form(K ~ ., data = dat)) ) }) @@ -135,7 +135,7 @@ test_that("weird cases", { # So model.frame ignores - signs in a model formula so Species is not removed # prior to model.matrix; otherwise this should have n_cols = 3 expect_equal( - template(4, 3, 150, NA, 1, iris, iris[-2], iris[,"Sepal.Width"]), + template(3, 4, 150, NA, 1, iris, iris[-2], iris[,"Sepal.Width"]), eval_descrs(get_descr_form(Sepal.Width ~ . - Species, data = iris)) ) @@ -145,7 +145,7 @@ test_that("weird cases", { x <- model.frame(~poly(Sepal.Length, 3), iris) attributes(x) <- attributes(as.data.frame(x))[c("names", "class", "row.names")] expect_equal( - template(1, 3, 150, NA, 0, iris, x, iris[,"Sepal.Width"]), + template(3, 1, 150, NA, 0, iris, x, iris[,"Sepal.Width"]), eval_descrs(get_descr_form(Sepal.Width ~ poly(Sepal.Length, 3), data = iris)) ) @@ -204,11 +204,11 @@ test_that("spark descriptor", { eval_descrs2 <- purrr::partial(eval_descrs, not = c(".x", ".y", ".dat")) expect_equal( - template2(4, 5, 150, NA, 1), + template2(5, 4, 150, NA, 1), eval_descrs2(get_descr_form(Sepal_Width ~ ., data = iris_descr)) ) expect_equal( - template2(1, 2, 150, NA, 1), + template2(2, 1, 150, NA, 1), eval_descrs2(get_descr_form(Sepal_Width ~ Species, data = iris_descr)) ) expect_equal( @@ -224,7 +224,7 @@ test_that("spark descriptor", { eval_descrs2(get_descr_form(Species ~ Sepal_Length, data = iris_descr)) ) expect_equivalent( - template2(3, 7, 24, rev(table(npk$K, dnn = NULL)), 3), + template2(7, 3, 24, rev(table(npk$K, dnn = NULL)), 3), eval_descrs2(get_descr_form(K ~ ., data = npk_descr)) ) diff --git a/vignettes/articles/Regression.Rmd b/vignettes/articles/Regression.Rmd index 543377757..1c137226e 100644 --- a/vignettes/articles/Regression.Rmd +++ b/vignettes/articles/Regression.Rmd @@ -122,15 +122,15 @@ When the model it being fit by `parsnip`, [_data descriptors_](https://topepo.gi Two relevant descriptors for what we are about to do are: - * `.cols()`: the number of columns in the data set that are associated with the predictors **prior to dummy variable creation**. - * `.preds()`: the number of predictors after dummy variables are created (if any). + * `.preds()`: the number of predictor _variables_ in the data set that are associated with the predictors **prior to dummy variable creation**. + * `.cols()`: the number of predictor _columns_ after dummy variables (or other encodings) are created. -Since `ranger` won't create indicator values, `.cols()` would be appropriate for using `mtry` for a bagging model. +Since `ranger` won't create indicator values, `.preds()` would be appropriate for using `mtry` for a bagging model. -For example, let's use an expression with the `.cols()` descriptor to fit a bagging model: +For example, let's use an expression with the `.preds()` descriptor to fit a bagging model: ```{r bagged} -rand_forest(mode = "regression", mtry = .cols(), trees = 1000) %>% +rand_forest(mode = "regression", mtry = .preds(), trees = 1000) %>% fit( log10(Sale_Price) ~ Longitude + Latitude + Lot_Area + Neighborhood + Year_Sold, data = ames_train, diff --git a/vignettes/parsnip_Intro.Rmd b/vignettes/parsnip_Intro.Rmd index 7fa9a9d6d..4448def91 100644 --- a/vignettes/parsnip_Intro.Rmd +++ b/vignettes/parsnip_Intro.Rmd @@ -97,33 +97,12 @@ To fit the model, you must: * have no `varying()` parameters, and * specify a computational engine. -The first step before fitting the model is to resolve the underlying model's syntax. A helper function called `translate` does this: - -```{r rf-translate} -library(parsnip) -rf_mod <- rand_forest(trees = 2000, mode = "regression") -rf_mod - -translate(rf_mod, engine = "ranger") -translate(rf_mod, engine = "randomForest") -``` - -Note that any extra engine-specific arguments have to be valid for the model: - -```{r rf-error, error = TRUE} -translate(rf_with_seed, engine = "ranger") -translate(rf_with_seed, engine = "randomForest") -``` - -`translate` shouldn't need to be used unless you are really curious about the model fit function or what R packages are needed to fit the model. The function in the next section will always translate the model. - - -## Fitting the Model - -These models can be fit using the `fit` function. Only the model object is returned. +For example, `rf_with_seed` above is not ready for fitting due the `varying()` parameter. We can set that parameter's value and then create the model fit: ```{r, eval = FALSE} -fit(rf_mod, mpg ~ ., data = mtcars, engine = "ranger") +rf_with_seed %>% + set_args(mtry = 4) %>% + fit(mpg ~ ., data = mtcars, engine = "ranger") ``` ``` @@ -132,23 +111,27 @@ fit(rf_mod, mpg ~ ., data = mtcars, engine = "ranger") #> Ranger result #> #> Call: -#> ranger::ranger(formula = formula, data = data, num.trees = ~2000, num.threads = 1, verbose = FALSE, seed = sample.int(10^5, 1)) +#> ranger::ranger(formula = formula, data = data, mtry = ~4, num.trees = ~2000, seed = ~63233, num.threads = 1, verbose = FALSE) #> #> Type: Regression #> Number of trees: 2000 #> Sample size: 32 #> Number of independent variables: 10 -#> Mtry: 3 +#> Mtry: 4 #> Target node size: 5 #> Variable importance mode: none #> Splitrule: variance -#> OOB prediction error (MSE): 5.71 -#> R squared (OOB): 0.843 +#> OOB prediction error (MSE): 5.57 +#> R squared (OOB): 0.847 ``` +Or, using the `randomForest` package: ```{r, eval = FALSE} -fit(rf_mod, mpg ~ ., data = mtcars, engine = "randomForest") +set.seed(56982) +rf_with_seed %>% + set_args(mtry = 4) %>% + fit(mpg ~ ., data = mtcars, engine = "randomForest") ``` ``` @@ -156,16 +139,16 @@ fit(rf_mod, mpg ~ ., data = mtcars, engine = "randomForest") #> #> #> Call: -#> randomForest(x = as.data.frame(x), y = y, ntree = ~2000) +#> randomForest(x = as.data.frame(x), y = y, ntree = ~2000, mtry = ~4, seed = ~63233) #> Type of random forest: regression #> Number of trees: 2000 -#> No. of variables tried at each split: 3 +#> No. of variables tried at each split: 4 #> -#> Mean of squared residuals: 5.6 -#> % Var explained: 84.1 +#> Mean of squared residuals: 5.52 +#> % Var explained: 84.3 ``` -Note that, in the case of the `ranger` fit, the call object shows `num.trees = ~2000`. The tilde is the consequence of `parsnip` using quosures to process the model specification's arguments. +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. diff --git a/vignettes/parsnip_Intro.html b/vignettes/parsnip_Intro.html deleted file mode 100644 index 2367dd7ea..000000000 --- a/vignettes/parsnip_Intro.html +++ /dev/null @@ -1,536 +0,0 @@ - - - - - - - - - - - - - - -parsnip Basics - - - - - - - - - - - - - - - - - -

    parsnip Basics

    - - - - -

    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:

    -
      -
    • randomForest::randomForest uses ntree,
    • -
    • ranger::ranger uses num.trees,
      -
    • -
    • Spark’s sparklyr::ml_random_forest uses num_trees.
    • -
    -

    Rather than remembering these values, a common interface to these models can be used with

    - -

    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.

    - -

    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:

    - -

    However, there might be other arguments that you would like to change or allow to vary. These are accessible using the ... slot. This is a named list of arguments in the form of the underlying function being called. For example, ranger has an option to set the internal random number seed. To set this to a specific value:

    - -

    If the model function contains the ellipses (...), these additional arguments can be passed along using others.

    -
    -
    -

    Process

    -

    To fit the model, you must:

    -
      -
    • define the model, including the mode,
    • -
    • have no varying() parameters, and
    • -
    • specify a computational engine.
    • -
    -

    The first step before fitting the model is to resolve the underlying model’s syntax. A helper function called translate does this:

    - -

    Note that any extra engine-specific arguments have to be valid for the model:

    - -

    translate shouldn’t need to be used unless you are really curious about the model fit function or what R packages are needed to fit the model. The function in the next section will always translate the model.

    -
    -
    -

    Fitting the Model

    -

    These models can be fit using the fit function. Only the model object is returned.

    - -
    #> parsnip model object
    -#> 
    -#> Ranger result
    -#> 
    -#> Call:
    -#>  ranger::ranger(formula = formula, data = data, num.trees = ~2000,      num.threads = 1, verbose = FALSE, seed = sample.int(10^5,          1)) 
    -#> 
    -#> Type:                             Regression 
    -#> Number of trees:                  2000 
    -#> Sample size:                      32 
    -#> Number of independent variables:  10 
    -#> Mtry:                             3 
    -#> Target node size:                 5 
    -#> Variable importance mode:         none 
    -#> Splitrule:                        variance 
    -#> OOB prediction error (MSE):       5.71 
    -#> R squared (OOB):                  0.843
    - -
    #> parsnip model object
    -#> 
    -#> 
    -#> Call:
    -#>  randomForest(x = as.data.frame(x), y = y, ntree = ~2000) 
    -#>                Type of random forest: regression
    -#>                      Number of trees: 2000
    -#> No. of variables tried at each split: 3
    -#> 
    -#>           Mean of squared residuals: 5.6
    -#>                     % Var explained: 84.1
    -
    - - - - - - - - - From 78ba2bd344e5199a5a93fc8c6a737b59851a2dec Mon Sep 17 00:00:00 2001 From: topepo Date: Thu, 18 Oct 2018 16:35:57 -0400 Subject: [PATCH 7/9] Updated vignettes with new changes and model guidelines --- README.md | 2 - _pkgdown.yml | 2 +- docs/articles/articles/Classification.html | 8 +- docs/articles/articles/Models.html | 103 +------ docs/articles/articles/Regression.html | 2 +- docs/articles/articles/Scratch.html | 337 +++++++++++---------- docs/articles/index.html | 2 +- docs/articles/parsnip_Intro.html | 2 +- docs/authors.html | 2 +- docs/index.html | 8 +- docs/news/index.html | 2 +- docs/reference/C5.0_train.html | 2 +- docs/reference/boost_tree.html | 2 +- docs/reference/check_empty_ellipse.html | 2 +- docs/reference/descriptors.html | 2 +- docs/reference/fit.html | 2 +- docs/reference/fit_control.html | 2 +- docs/reference/index.html | 2 +- docs/reference/keras_mlp.html | 2 +- docs/reference/lending_club.html | 2 +- docs/reference/linear_reg.html | 2 +- docs/reference/logistic_reg.html | 2 +- docs/reference/make_classes.html | 2 +- docs/reference/mars.html | 2 +- docs/reference/mlp.html | 2 +- docs/reference/model_fit.html | 3 +- docs/reference/model_printer.html | 2 +- docs/reference/model_spec.html | 2 +- docs/reference/multi_predict.html | 2 +- docs/reference/multinom_reg.html | 2 +- docs/reference/nearest_neighbor.html | 2 +- docs/reference/other_predict.html | 2 +- docs/reference/predict.model_fit.html | 2 +- docs/reference/rand_forest.html | 2 +- docs/reference/reexports.html | 2 +- docs/reference/set_args.html | 2 +- docs/reference/show_call.html | 2 +- docs/reference/surv_reg.html | 2 +- docs/reference/translate.html | 2 +- docs/reference/type_sum.model_spec.html | 2 +- docs/reference/varying.html | 2 +- docs/reference/varying_args.html | 2 +- docs/reference/wa_churn.html | 2 +- docs/reference/xgb_train.html | 2 +- vignettes/articles/Models.Rmd | 17 +- vignettes/articles/Scratch.Rmd | 55 ++-- 46 files changed, 273 insertions(+), 336 deletions(-) diff --git a/README.md b/README.md index f31c44574..4905606f3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# parsnip - [![Travis build status](https://travis-ci.org/topepo/parsnip.svg?branch=master)](https://travis-ci.org/topepo/parsnip) [![Coverage status](https://codecov.io/gh/topepo/parsnip/branch/master/graph/badge.svg)](https://codecov.io/github/topepo/parsnip?branch=master) ![](https://img.shields.io/badge/lifecycle-experimental-orange.svg) diff --git a/_pkgdown.yml b/_pkgdown.yml index dd0a8ef76..054c37756 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -2,7 +2,7 @@ template: package: tidytemplate params: part_of: tidymodels - footer: probably 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/articles/articles/Classification.html b/docs/articles/articles/Classification.html index 56a2bcf6b..4728624de 100644 --- a/docs/articles/articles/Classification.html +++ b/docs/articles/articles/Classification.html @@ -183,12 +183,12 @@

    Classification Example

    #> # A tibble: 1 x 2 #> .metric .estimate #> <chr> <dbl> -#> 1 accuracy 0.812 +#> 1 accuracy 0.814 test_results %>% conf_mat(truth = Status, estimate = `nnet class`) #> Truth #> Prediction bad good -#> bad 177 73 -#> good 136 727
    +#> bad 178 72 +#> good 135 728